You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-- Conduit CLI Version: 4.0.0
-- Conduit project version: 4.0.0
-- Updating to version 1 on new database...
PostgreSQL connecting, manson@localhost:5432/notes.
Initializating database...
CREATE TABLE _conduit_version_pgsql (versionNumber INT NOT NULL UNIQUE,dateOfUpgrade TIMESTAMP NOT NULL)
Applying migration version 1...
CREATE TABLE _Note (id BIGSERIAL PRIMARY KEY,createdTime TIMESTAMP NOT NULL,modifiedTime TIMESTAMP NOT NULL,title TEXT NOT NULL UNIQUE,content TEXT NOT NULL,isRecycle BOOLEAN NOT NULL DEFAULT false)
CREATE INDEX _Note_createdTime_idx ON _Note (createdTime)
CREATE INDEX _Note_modifiedTime_idx ON _Note (modifiedTime)
CREATE TABLE _Tag (id BIGSERIAL PRIMARY KEY,name TEXT NOT NULL UNIQUE)
CREATE INDEX _Tag_name_idx ON _Tag (name)
ALTER TABLE _Note ADD COLUMN tag_id BIGINT NULL
CREATE INDEX _Note_tag_id_idx ON _Note (tag_id)
ALTER TABLE ONLY _Note ADD FOREIGN KEY (tag_id) REFERENCES _Tag (id) ON DELETE SET NULL
Seeding data from migration version 1...
Query:execute (2ms) INSERT INTO _Tag (name) VALUES (@name) -> []
*** There was an issue. Reason: column "tag" of relation "_note" does not exist. Table: null Column: null
I change value of tag from 0 to String value "标签", but it still gave me same error.
but if I totally remove tag from inserting initial values, it got works with actual value of tag null.
hi.
I have two tables: Tag and Note
`
class Tag extends ManagedObject<_Tag> implements _Tag {}
class _Tag {
@PrimaryKey
int? id;
@column(unique: true, indexed: true)
String? name;
ManagedSet? notes;
}
class Note extends ManagedObject<_Note> implements _Note {}
class _Note {
@PrimaryKey
int? id;
@column(indexed: true)
DateTime? createdTime;
@column(indexed: true)
DateTime? modifiedTime;
@RELATE(#notes)
Tag? tag;
@column(unique: true)
String? title;
String? content;
@column(defaultValue: 'false')
bool? isRecycle;
}
`
I got correct migration file when I run "conduit db generate".
following code is inserted into seed() method.
`
@OverRide
Future seed() async {
await database.store?.execute("INSERT INTO _Tag (name) VALUES (@name)",
substitutionValues: {
"name": "自助餐券",
});
}
`
I got error when I run "conduit db update.."
-- Conduit CLI Version: 4.0.0
-- Conduit project version: 4.0.0
-- Updating to version 1 on new database...
PostgreSQL connecting, manson@localhost:5432/notes.
Initializating database...
CREATE TABLE _conduit_version_pgsql (versionNumber INT NOT NULL UNIQUE,dateOfUpgrade TIMESTAMP NOT NULL)
Applying migration version 1...
CREATE TABLE _Note (id BIGSERIAL PRIMARY KEY,createdTime TIMESTAMP NOT NULL,modifiedTime TIMESTAMP NOT NULL,title TEXT NOT NULL UNIQUE,content TEXT NOT NULL,isRecycle BOOLEAN NOT NULL DEFAULT false)
CREATE INDEX _Note_createdTime_idx ON _Note (createdTime)
CREATE INDEX _Note_modifiedTime_idx ON _Note (modifiedTime)
CREATE TABLE _Tag (id BIGSERIAL PRIMARY KEY,name TEXT NOT NULL UNIQUE)
CREATE INDEX _Tag_name_idx ON _Tag (name)
ALTER TABLE _Note ADD COLUMN tag_id BIGINT NULL
CREATE INDEX _Note_tag_id_idx ON _Note (tag_id)
ALTER TABLE ONLY _Note ADD FOREIGN KEY (tag_id) REFERENCES _Tag (id) ON DELETE SET NULL
Seeding data from migration version 1...
Query:execute (2ms) INSERT INTO _Tag (name) VALUES (@name) -> []
*** There was an issue. Reason: column "tag" of relation "_note" does not exist. Table: null Column: null
I change value of tag from 0 to String value "标签", but it still gave me same error.
but if I totally remove tag from inserting initial values, it got works with actual value of tag null.
[{"id":1,"createdTime":"2022-12-02T19:14:01.542438Z","modifiedTime":"2022-12-02T19:14:01.542438Z","title":"标题","content":"内容","isRecycle":false,"tag":null}]
I wonder if there is a way to fill this kind of initial data. could you give me any advise, thanks.
The text was updated successfully, but these errors were encountered: