Your schema looks OK, whats the rest of your code look like? Rob
On Thu, May 21, 2015 at 6:05 PM, Marlik <[email protected]> wrote: > Sorry, that is dump: > > CREATE TABLE authors ( > authorid INTEGER PRIMARY KEY AUTOINCREMENT, > author VARCHAR(255) UNIQUE, > pass VARCHAR(255), > type INTEGER > ); > > CREATE TABLE posts ( > postid INTEGER PRIMARY KEY AUTOINCREMENT, > title TEXT, > post TEXT, > tags TEXT, > postime DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, > authorid REFERENCES authors(authorid) > ); > > CREATE TABLE comments ( > commentid INTEGER PRIMARY KEY AUTOINCREMENT, > comment TEXT, > comtime DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, > authorid REFERENCES authors(authorid), > postid REFERENCES posts(postid) > ); > > четверг, 21 мая 2015 г., 12:13:05 UTC+3 пользователь Marlik написал: > >> Hello, I receive an error. I am doing so... >> >> >> example dump here - >> http://pragmaticperl.com/issues/06/pragmaticperl-06-dbixclass-%D0%B2-%D0%BF%D1%80%D0%B8%D0%BC%D0%B5%D1%80%D0%B0%D1%85.html >> >> sqlite3 blog.db < blog.sql >> >> dbicdump -o dump_directory=./lib -o >> components='["InflateColumn::DateTime"]' Schema dbi:SQLite:./dump/blog.db >> >> in MyApp: >> >> use Schema; >> >> has schema => sub { >> return Schema->connect('dbi:SQLite:' . ($ENV{BLOG_DB} || >> './dump/blog.db')); >> }; >> >> in startup: >> >> $self->helper(db => sub { $self->app->schema }); >> >> in controller: >> >> my $self = shift; >> >> my ($title, $body, $tags) = @{$self->req->params->to_hash}{ 'title', >> 'body', 'tags' }; >> >> my $result = $self->db->resultset('Post')->create({ >> title => '$title', >> post => '$body', >> tags => '$tags' >> }); >> >> I receive an error: >> >> DBIx::Class::Storage::DBI::_prepare_sth(): DBI Exception: DBD::SQLite::db >> prepare_cached failed: no such table: posts [for Statement "INSERT INTO >> posts ( post, tags, title) VALUES ( ?, ?, ? )" >> >> >> >> What am i doing wrong? Thanks. >> >> >> >> -- > You received this message because you are subscribed to the Google Groups > "Mojolicious" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/mojolicious. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
