Subject: | postgresql functions like now() fails to translate into sqlite now in DEFAULT clause |
postgresql functions like now() fails to translate into sqlite 'now' or
CURRENT_TIMESTAMP in
DEFAULT clause. Instead. now() comes up as a syntax error by the parser
in the CREATE TABLE statements. see: attachements.
Subject: | Cluster.pm |
package Novus::Schema::Cluster;
=head1 NAME
Novus::Schema::Group - Group object class
=head1 DESCRIPTION
=cut
use strict;
use warnings;
use base 'DBIx::Class';
__PACKAGE__->load_components("InflateColumn::DateTime", "PK::Auto", "Core");
__PACKAGE__->table("cluster");
=head1 INTERFACE
=head2 ACCESSORS
All accessors can be called with a new value. Doing so will update the object,
but it will not be persisted untill after you call update.
=head3 id
A running id for theese kinds of objects. Used in relationships with other
objects
=head3 words
List of all words used to connect items, and how many times they have been used in this group.
=cut
__PACKAGE__->add_columns(
"id" => { data_type => "INTEGER", is_nullable => 0, size => undef, is_auto_increment => 0 },
"locked" => { data_type => "INTEGER", is_nullable => 1, size => undef, default_value => undef },
"datecreated" => { data_type => "timestamp", is_nullable => 0, size => undef, default_value => 'now()'},
"words" => { data_type => "text", is_nullable => 0, size => undef, default_value => '' },
"datemodified" => { data_type => "timestamp", is_nullable => 0, size => undef , default_value => 'now()'},
);
__PACKAGE__->set_primary_key("id");
=head2 RELATIONSHIPS
__PACKAGE__->has_many('_feed_items' => 'Novus::Schema::FeedItem', { "foreign.item" => "self.id" });
=head3 items
Returns the middle object between group and item.
=cut
__PACKAGE__->has_many('items' => 'Novus::Schema::Item', { "foreign.cluster" => "self.id" }, { cascade_delete => 0 } );
=head2 METHODS
=head3 created
Returns datecreated. Used to conform to the interface Novus::Xapian expects
=cut
sub created {
return shift->datecreated;
}
1;
__END__
=head1 AUTHOR
Thore Harald Hoye C<< <thore@startsiden.no> >>
Subject: | Item.pm |
Message body is not shown because it is too large.
Subject: | error_message.txt |
DBIx::Class::Schema::deploy(): DBIx::Class::Schema::deploy(): DBI Exception: DBD::SQLite::db do failed: near "(": syntax error [for Statement "CREATE TABLE cluster (
id INTEGER PRIMARY KEY NOT NULL,
locked INTEGER,
datecreated timestamp NOT NULL DEFAULT now(),
words text NOT NULL DEFAULT '',
datemodified timestamp NOT NULL DEFAULT now()
)"] at t/01.loading.t line 14
(running "CREATE TABLE cluster (
id INTEGER PRIMARY KEY NOT NULL,
locked INTEGER,
datecreated timestamp NOT NULL DEFAULT now(),
words text NOT NULL DEFAULT '',
datemodified timestamp NOT NULL DEFAULT now()
)") at t/01.loading.t line 14
DBIx::Class::Schema::deploy(): DBIx::Class::Schema::deploy(): DBI Exception: DBD::SQLite::db do failed: near "(": syntax error [for Statement "CREATE TABLE item (
id INTEGER PRIMARY KEY NOT NULL,
datecreated timestamp NOT NULL DEFAULT now(),
title varchar(255) NOT NULL,
summary text,
content text,
atomid varchar(255),
datemodified timestamp NOT NULL DEFAULT now(),
lastchecked timestamp,
errorcount integer NOT NULL DEFAULT 0,
expired boolean,
nilsimsa char(64),
sameid integer,
link varchar(1024) NOT NULL,
wap boolean,
waplink text,
cluster integer,
ready_for_index boolean,
time_zone char(5),
image_url varchar(255),
keywords text,
FOREIGN KEY (cluster) REFERENCES cluster(id) ON UPDATE CASCADE,
FOREIGN KEY (sameid) REFERENCES item(id) ON DELETE CASCADE ON UPDATE CASCADE
)"] at t/01.loading.t line 14
(running "CREATE TABLE item (
id INTEGER PRIMARY KEY NOT NULL,
datecreated timestamp NOT NULL DEFAULT now(),
title varchar(255) NOT NULL,
summary text,
content text,
atomid varchar(255),
datemodified timestamp NOT NULL DEFAULT now(),
lastchecked timestamp,
errorcount integer NOT NULL DEFAULT 0,
expired boolean,
nilsimsa char(64),
sameid integer,
link varchar(1024) NOT NULL,
wap boolean,
waplink text,
cluster integer,
ready_for_index boolean,
time_zone char(5),
image_url varchar(255),
keywords text,
FOREIGN KEY (cluster) REFERENCES cluster(id) ON UPDATE CASCADE,
FOREIGN KEY (sameid) REFERENCES item(id) ON DELETE CASCADE ON UPDATE CASCADE
)") at t/01.loading.t line 14
DBIx::Class::Schema::deploy(): DBIx::Class::Schema::deploy(): DBI Exception: DBD::SQLite::db do failed: no such table: main.item [for Statement "CREATE INDEX item_idx_cluster ON item (cluster)"] at t/01.loading.t line 14
(running "CREATE INDEX item_idx_cluster ON item (cluster)") at t/01.loading.t line 14
DBIx::Class::Schema::deploy(): DBIx::Class::Schema::deploy(): DBI Exception: DBD::SQLite::db do failed: no such table: main.item [for Statement "CREATE INDEX item_idx_sameid ON item (sameid)"] at t/01.loading.t line 14