KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Background: we have a Grails 1.3.7 app and are using Liquibase to manage our database migrations. I am trying to add a new column to an existing table which is not empty. My changeset looks like this: changeSet(author: "someCoolGuy (generated)", id: "1326842592275-1") { addColumn(tableName: "layer") { column(name: "abstract_trimmed", type: "VARCHAR(455)", value: "No text") { constraints(nullable: "false") } } } Which should have inserted the value 'No text' into every existing row, and therefore satisfied the not null constraint. Liquibase "Add Column" docs . But when the migrations changesets are being applied I get the following exception: liquibase.exception.DatabaseException: Error executing SQL ALTER TABLE layer ADD abstract_trimmed VARCHAR(455) NOT NULL: ERROR: column "abstract_trimmed" contains null values Which looks to me like it is not using the 'value' attribute. If I change my changeset to work look like the following I can achieve the same thing. But I don't want to (and shouldn't have to) do this. changeSet(author: "someCoolGuy (generated)", id: "1326842592275-1") { addColumn(tableName: "layer") { column(name: "abstract_trimmed", type: "VARCHAR(455)") } addNotNullConstraint(tableName: "layer", columnName:"abstract_trimmed", defaultNullValue: "No text") } Is Liquibase really ignoring my value attribute, or is there something else going on here that I can't see? I am using Grails 1.3.7, Database-migration plugin 1.0, Postgres 9.0
Tags (comma-separated)
Save Edits
Cancel