Closed thosakwe closed 3 years ago
@thosakwe commented:
Try "'empty description'"
instead, and see if it works. I'm not sure off the top of my head if the migration tool automatically escapes strings.
@anondev32 commented:
@SerializableField(defaultValue: "'empty description'")
String get description;
build to
..defaultsTo('\'empty description\'');
results in
PostgreSQLSeverity.error 42601: syntax error at or near "\"
@anondev32 commented:
Sorry, i tried to dig into the migration and orm code, but couldn't find the part where it actually generates the SQL statements.
@thosakwe commented:
Can you turn in query logging in your PostgreSQL instance? The MigrationRunner API does not yet use QueryExecutor
(it predates it), so you can't yet use the Dart logger.
I intend to do some maintenance work this weekend, but am in training all week.
@anondev32 commented:
Will do soon, keeping you updated.
I am actually very happy to help you with developing the framework/packages but have a lot going on right now. Will take some time for me to dig into the code.
@anondev32 commented:
..defaultsTo('\'empty description\'');
ERROR: syntax error at or near "\" at character 109
2019-05-09 19:12:16.327 UTC [47] STATEMENT: CREATE TABLE "cars" (
"id" serial PRIMARY KEY,
"make" varchar NOT NULL,
"description" varchar DEFAULT \'empty description\',
"family_friendly" boolean NOT NULL,
"recalled_at" timestamp NOT NULL,
"created_at" timestamp,
"updated_at" timestamp
);
@anondev32 commented:
defaultsTo('"empty description"')
2019-05-09 19:16:43.180 UTC [60] ERROR: column "empty description" does not exist
2019-05-09 19:16:43.180 UTC [60] STATEMENT: CREATE TABLE "cars" (
"id" serial PRIMARY KEY,
"make" varchar NOT NULL,
"description" varchar DEFAULT "empty description",
"family_friendly" boolean NOT NULL,
"recalled_at" timestamp NOT NULL,
"created_at" timestamp,
"updated_at" timestamp
);
@anondev32 commented:
..defaultsTo("'empty description'");
2019-05-09 19:18:33.384 UTC [64] ERROR: syntax error at or near "\" at character 109
2019-05-09 19:18:33.384 UTC [64] STATEMENT: CREATE TABLE "cars" (
"id" serial PRIMARY KEY,
"make" varchar NOT NULL,
"description" varchar DEFAULT \'empty description\',
"family_friendly" boolean NOT NULL,
"recalled_at" timestamp NOT NULL,
"created_at" timestamp,
"updated_at" timestamp
);
@anondev32 commented:
I found the issue, will create a pull request asap.
This issue was originally created by @anondev32 here, before being automatically moved: https://github.com/angel-dart-archive/orm/issues/81
builds to:
table.varChar('description')..defaultsTo('empty description');
When i remove
..defaultsTo('empty description');
from the generated file everything works perfectly.