· 8 years ago · Jan 19, 2018, 05:12 PM
1bash_prompt$ sqlite3 /tmp/some.db 'CREATE TABLE IF NOT EXISTS test2( pk INTEGER PRIMARY KEY AUTOINCREMENT, num INTEGER, CONSTRAINT test2_contraint UNIQUE(num) )'
2i:SQLite:/tmp/some.db"]);'
3
4bash_prompt$ perl -e 'use DBIx::Cla_schema_at/; make_schema_at("SomeSchema",{ debug => 1},["dbi:SQLite:/tmp/some.db"]);'
5SomeSchema::Test2->load_components("Core");
6SomeSchema::Test2->table("test2");
7SomeSchema::Test2->add_columns(
8 "pk",
9 {
10 data_type => "INTEGER",
11 default_value => undef,
12 is_nullable => 1,
13 size => undef,
14 },
15 "num",
16 {
17 data_type => "INTEGER",
18 default_value => undef,
19 is_nullable => 1,
20 size => undef,
21 },
22);
23SomeSchema::Test2->set_primary_key("pk");
24SomeSchema::Test2->add_unique_constraint("CONSTRAINT_unique", ["constraint"]);
25DBIx::Class::Schema::Loader::make_schema_at(): No such column constraint on table test2 at -e line 1