Title: automatic migrate support for containerized deploy · Issue #146 · sqlchat/sqlchat · GitHub
Open Graph Title: automatic migrate support for containerized deploy · Issue #146 · sqlchat/sqlchat
X Title: automatic migrate support for containerized deploy · Issue #146 · sqlchat/sqlchat
Description: Is your feature request related to a problem? The db schema is not initialized automatically after the service is started: 9d178106ae94:/# psql -U sqlchat_user -d sqlchat psql (14.10) Type "help" for help. sqlchat=# \l List of databases ...
Open Graph Description: Is your feature request related to a problem? The db schema is not initialized automatically after the service is started: 9d178106ae94:/# psql -U sqlchat_user -d sqlchat psql (14.10) Type "help" f...
X Description: Is your feature request related to a problem? The db schema is not initialized automatically after the service is started: 9d178106ae94:/# psql -U sqlchat_user -d sqlchat psql (14.10) Type "he...
Opengraph URL: https://github.com/sqlchat/sqlchat/issues/146
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"automatic migrate support for containerized deploy","articleBody":"### Is your feature request related to a problem?\n\nThe db schema is not initialized automatically after the service is started:\r\n\r\n```bash\r\n9d178106ae94:/# psql -U sqlchat_user -d sqlchat\r\npsql (14.10)\r\nType \"help\" for help.\r\n\r\nsqlchat=# \\l\r\n List of databases\r\n Name | Owner | Encoding | Collate | Ctype | Access privileges\r\n-----------+--------------+----------+------------+------------+-------------------------------\r\n postgres | sqlchat_user | UTF8 | en_US.utf8 | en_US.utf8 |\r\n rbac_prod | sqlchat_user | UTF8 | en_US.utf8 | en_US.utf8 |\r\n sqlchat | sqlchat_user | UTF8 | en_US.utf8 | en_US.utf8 |\r\n template0 | sqlchat_user | UTF8 | en_US.utf8 | en_US.utf8 | =c/sqlchat_user +\r\n | | | | | sqlchat_user=CTc/sqlchat_user\r\n template1 | sqlchat_user | UTF8 | en_US.utf8 | en_US.utf8 | =c/sqlchat_user +\r\n | | | | | sqlchat_user=CTc/sqlchat_user\r\n(5 rows)\r\n\r\nsqlchat=# \\d\r\nDid not find any relations.\r\nsqlchat=# \\dt\r\nDid not find any relations.\r\nsqlchat=#\r\n...\r\npostgres | 2024-01-29 13:20:04.732 CST [22] LOG: database system was shut down at 2024-01-29 13:15:06 CST\r\npostgres | 2024-01-29 13:20:04.742 CST [1] LOG: database system is ready to accept connections\r\npostgres | 2024-01-29 13:37:14.614 CST [1458] ERROR: relation \"sqlchat.users\" does not exist at character 215\r\npostgres | 2024-01-29 13:37:14.614 CST [1458] STATEMENT: SELECT \"sqlchat\".\"users\".\"id\", \"sqlchat\".\"users\".\"name\", \"sqlchat\".\"users\".\"email\", \"sqlchat\".\"users\".\"email_verified\", \"sqlchat\".\"users\".\"image\", \"sqlchat\".\"users\".\"stripe_id\", \"sqlchat\".\"users\".\"created_at\" FROM \"sqlchat\".\"users\" WHERE (\"sqlchat\".\"users\".\"email\" = $1 AND 1=1) LIMIT $2 OFFSET $3\r\n```\r\n\r\nand also need to connect to the database externally, and then manually execute the migration\r\n\r\n```bash\r\n➜ sqlchat git:(feat-add-org-header) ✗ pnpm prisma migrate dev\r\nEnvironment variables loaded from .env\r\nPrisma schema loaded from prisma/schema.prisma\r\nDatasource \"db\": PostgreSQL database \"sqlchat\", schema \"sqlchat\" at \"127.0.0.1:5432\"\r\n\r\nApplying migration `20230502100414_init`\r\nApplying migration `20230505101306_account_and_payment`\r\nApplying migration `20230517161946_subscription`\r\nApplying migration `20230518165639_created_at_to_users_table`\r\nApplying migration `20230521103659_separate_payment_from_subscription`\r\nApplying migration `20230521112004_remove_subscription_status_add_cancel_at`\r\n\r\nThe following migration(s) have been applied:\r\n\r\nmigrations/\r\n └─ 20230502100414_init/\r\n └─ migration.sql\r\n └─ 20230505101306_account_and_payment/\r\n └─ migration.sql\r\n └─ 20230517161946_subscription/\r\n └─ migration.sql\r\n └─ 20230518165639_created_at_to_users_table/\r\n └─ migration.sql\r\n └─ 20230521103659_separate_payment_from_subscription/\r\n └─ migration.sql\r\n └─ 20230521112004_remove_subscription_status_add_cancel_at/\r\n └─ migration.sql\r\n\r\nYour database is now in sync with your schema.\r\n```\r\n\n\n### Describe the solution you'd like\n\nadding automatic execution of database migrate when NEXT_PUBLIC_USE_DATABASE is set.\n\n### Additional context\n\n_No response_","author":{"url":"https://github.com/lushenle","@type":"Person","name":"lushenle"},"datePublished":"2024-01-29T07:07:36Z","url":"https://github.com/sqlchat/sqlchat/issues/146"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:54c55f1f-c372-4a46-7b79-5db300546c00 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C8DC:BE8D0:489BB8:663C38:6B0471B1 |
| html-safe-nonce | f97935d364289b9acc49fa0ba1d95c1c23fdd0dc3a2ccd61d52d428f1040f9de |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOERDOkJFOEQwOjQ4OUJCODo2NjNDMzg6NkIwNDcxQjEiLCJ2aXNpdG9yX2lkIjoiODM1ODY1MjEwODE0NDQwNjk2MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 12727f2f78bcc182b60cbea292b77f9918ddfcec1f1ae2ccda479be9565c9a45 |
| hovercard-subject-tag | issue:2104798684 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/sqlchat/sqlchat/146/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9ccc6f8900769d22c65ad9967f369a36562aff516757af8706a161676d00de55/sqlchat/sqlchat/issues/146 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9ccc6f8900769d22c65ad9967f369a36562aff516757af8706a161676d00de55/sqlchat/sqlchat/issues/146 |
| og:image:alt | Is your feature request related to a problem? The db schema is not initialized automatically after the service is started: 9d178106ae94:/# psql -U sqlchat_user -d sqlchat psql (14.10) Type "help" f... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lushenle |
| hostname | github.com |
| expected-hostname | github.com |
| None | ae8802492f12d3ba4f6b0d814054e617a2a5616b6327bf8555c10cd5b0dc2a6f |
| turbo-cache-control | no-preview |
| go-import | github.com/sqlchat/sqlchat git https://github.com/sqlchat/sqlchat.git |
| octolytics-dimension-user_id | 128299021 |
| octolytics-dimension-user_login | sqlchat |
| octolytics-dimension-repository_id | 614656648 |
| octolytics-dimension-repository_nwo | sqlchat/sqlchat |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 614656648 |
| octolytics-dimension-repository_network_root_nwo | sqlchat/sqlchat |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cfb5f24c6e01d85f70804652a5107e5cac03a161 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width