My "USE" statements break the utility
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 3.4k
- Forks
- 292
- PR merge metrics
- No merged PRs in 30d
Description
If my migration script looks like this :
-- +migrate Up
CREATE DATABASE /!32312 IF NOT EXISTS/ "apollo" /*!40100 DEFAULT CHARACTER SET latin1 */;
USE "apollo";
DROP TABLE IF EXISTS "items";
I get these errors on run :
Migration failed: Error 1146: Table 'apollo.gorp_migrations' doesn't exist handling 000000-apollo.sql_
If I remove the "USE " statement, it works fine.
How are we to create multiple databases? Surely that should not be a manual step?
Does the sql-migrate only work on pre-existing databases? I had a look at the undocumented "schema" config parameter, but it just kept generating an sql error when executing :
sql-migrate status -config=migrations/apollo/dbconfig.yml
Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'create table if not exists apollo.apollo-migrations (id varchar(255) not nul' at line 1)
any help much appreciated.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the migration and status commands from the issue with MySQL, including the USE statement and schema configuration. Inspect the migration execution and schema handling paths; done when database creation and migration-table setup behave correctly, or the supported limitation is clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, mysql, sql
- Domain
- cli, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100