rubenv / rubenv/sql-migrate

how to configure LineSeparator?

Open
#135 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
3.4k
Forks
292
PR merge metrics
No merged PRs in 30d

Description

I'm using mssql and I'm trying to use GO as line separator as stated here

this is what I tried so far in my dbconf.yml

development:
  dialect: mssql
  datasource: sqlserver://sa:xxxxxx@server
  dir: migrations
  table: migrations
  sqlparse.LineSeparator: GO
  LineSeparator: GO
  lineseparator: GO
  sqlparse.lineseparator: GO

it doesn't seem to take the configuration, and when I try to run a migration that contains GO I get:

$ sql-migrate.exe up
Migration failed: mssql: Incorrect syntax near 'GO'. handling 0001-table_test.sql

this is the migration

-- +migrate Up
CREATE TABLE [dbo].[Test](
	[id] [numeric](18, 0) IDENTITY(1,1) NOT NULL,
	[name] [varchar](500) NULL,
	[surname] [varchar](500) NULL,
 CONSTRAINT [PK_Test] PRIMARY KEY CLUSTERED
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
;

-- +migrate Down
DROP TABLE [dbo].[Test]
GO
;

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the dbconf.yml settings and the sql-migrate.exe entry point, then reproduce the failure using 0001-table_test.sql and its GO separators. Trace how the configuration is read and how the migration SQL is split; done means the documented LineSeparator setting is recognized and the provided migration runs without the syntax error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.