DBIx-Class-Helper-ResultSet-MySQLHacks

 view release on metacpan or  search on metacpan

t/lib/CDTest.pm  view on Meta::CPAN

        [ 17, 15, "42 Minutes of Silence", 2011 ],
        [ 19, 15, "Two", 2012, 17 ],
        [ 21, 15, "852", 2015, 19 ],
        [ 22, 17, "Glass Window Soundtrack", 2009 ],
        [ 24, 17, "Magenta", 2014, 22 ],
        [ 25, 17, "Yellow", 2014, 24 ],
        [ 30, 17, "Cyan", 2014, 25 ],
    ]);

    $schema->populate('Tag', [
        [ qw/tagid cd tag/ ],
        [ 1, 1, "Blue" ],
        [ 2, 2, "Blue" ],
        [ 3, 3, "Blue" ],
        [ 4, 5, "Blue" ],
        [ 5, 2, "Cheesy" ],
        [ 6, 4, "Cheesy" ],
        [ 7, 5, "Cheesy" ],
        [ 8, 2, "Shiny" ],
        [ 9, 4, "Shiny" ],
    ]);

t/lib/CDTest/Schema/Result/Tag.pm  view on Meta::CPAN

use base 'DBIx::Class::Core';

=head1 TABLE: C<tags>

=cut

__PACKAGE__->table("tags");

=head1 ACCESSORS

=head2 tagid

  data_type: 'integer'
  is_auto_increment: 1
  is_nullable: 0

=head2 cd

  data_type: 'integer'
  is_foreign_key: 1
  is_nullable: 0

=head2 tag

  data_type: 'varchar'
  is_nullable: 0
  size: 100

=cut

__PACKAGE__->add_columns(
  "tagid",
  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
  "cd",
  { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
  "tag",
  { data_type => "varchar", is_nullable => 0, size => 100 },
);

=head1 PRIMARY KEY

=over 4

=item * L</tagid>

=back

=cut

__PACKAGE__->set_primary_key("tagid");

=head1 UNIQUE CONSTRAINTS

=head2 C<tagid_cd_tag_unique>

=over 4

=item * L</tagid>

=item * L</cd>

=item * L</tag>

=back

=cut

__PACKAGE__->add_unique_constraint("tagid_cd_tag_unique", ["tagid", "cd", "tag"]);

=head2 C<tagid_cd_unique>

=over 4

=item * L</tagid>

=item * L</cd>

=back

=cut

__PACKAGE__->add_unique_constraint("tagid_cd_unique", ["tagid", "cd"]);

=head2 C<tagid_tag_cd_unique>

=over 4

=item * L</tagid>

=item * L</tag>

=item * L</cd>

=back

=cut

__PACKAGE__->add_unique_constraint("tagid_tag_cd_unique", ["tagid", "tag", "cd"]);

=head2 C<tagid_tag_unique>

=over 4

=item * L</tagid>

=item * L</tag>

=back

=cut

__PACKAGE__->add_unique_constraint("tagid_tag_unique", ["tagid", "tag"]);

=head1 RELATIONS

=head2 cd

Type: belongs_to

Related object: L<CDTest::Schema::Result::CD>

=cut

t/lib/sqlite.sql  view on Meta::CPAN

  "lyric_id" integer NOT NULL,
  "text" varchar(100) NOT NULL,
  FOREIGN KEY ("lyric_id") REFERENCES "lyrics"("lyric_id") ON DELETE CASCADE ON UPDATE CASCADE
);

CREATE INDEX "lyric_versions_idx_lyric_id" ON "lyric_versions" ("lyric_id");

CREATE UNIQUE INDEX "lyric_versions_lyric_id_text" ON "lyric_versions" ("lyric_id", "text");

CREATE TABLE "tags" (
  "tagid" INTEGER PRIMARY KEY NOT NULL,
  "cd" integer NOT NULL,
  "tag" varchar(100) NOT NULL,
  FOREIGN KEY ("cd") REFERENCES "cd"("cdid") ON DELETE CASCADE ON UPDATE CASCADE
);

CREATE INDEX "tags_idx_cd" ON "tags" ("cd");

CREATE UNIQUE INDEX "tagid_cd" ON "tags" ("tagid", "cd");

CREATE UNIQUE INDEX "tagid_cd_tag" ON "tags" ("tagid", "cd", "tag");

CREATE UNIQUE INDEX "tags_tagid_tag" ON "tags" ("tagid", "tag");

CREATE UNIQUE INDEX "tags_tagid_tag_cd" ON "tags" ("tagid", "tag", "cd");

CREATE TABLE "cd_to_producer" (
  "cd" integer NOT NULL,
  "producer" integer NOT NULL,
  "attribute" integer,
  PRIMARY KEY ("cd", "producer"),
  FOREIGN KEY ("cd") REFERENCES "cd"("cdid") ON DELETE CASCADE ON UPDATE CASCADE,
  FOREIGN KEY ("producer") REFERENCES "producer"("producerid")
);



( run in 1.536 second using v1.01-cache-2.11-cpan-5735350b133 )