Skip to content

Commit

Permalink
fix(introspection, sqlserver): Accept (and ignore) multi-line shared …
Browse files Browse the repository at this point in the history
…defaults
  • Loading branch information
janpio committed May 23, 2024
1 parent b4fe3e6 commit 87324ad
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions schema-engine/sql-migration-tests/tests/migrations/mssql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,43 @@ fn shared_default_constraints_are_ignored_issue_5423(api: TestApi) {
.assert_no_steps();
}

#[test_connector(tags(Mssql))]
fn shared_default_constraints_with_multilines_are_ignored_issue_24275(api: TestApi) {
let schema = api.schema_name();

api.raw_cmd(&format!(
r#"
/* This is a comment */
CREATE DEFAULT [{schema}].dogdog AS 'mugi'
"#
));

api.raw_cmd(&format!(
r#"
CREATE TABLE [{schema}].dogs (
id INT IDENTITY,
name NVARCHAR(255) NOT NULL,
CONSTRAINT [dogs_pkey] PRIMARY KEY CLUSTERED ([id] ASC)
)
"#
));

api.raw_cmd(&format!("sp_bindefault '{schema}.dogdog', '{schema}.dogs.name'"));

let dm = r#"
model dogs {
id Int @id @default(autoincrement())
name String @db.NVarChar(255)
}
"#;

api.schema_push_w_datasource(dm)
.migration_id(Some("first"))
.send()
.assert_green()
.assert_no_steps();
}

#[test_connector(tags(Mssql))]
fn mssql_apply_migrations_error_output(api: TestApi) {
let dm = "";
Expand Down

0 comments on commit 87324ad

Please sign in to comment.