Browse files

Added targeting_type, mutation_type, final_cassette_function tables

  • Loading branch information...
1 parent 8c2f129 commit d97bf8626a1377215d6f534e1e1f93a4803782b2 @markquintontulloch markquintontulloch committed Jul 26, 2012
View
109 ddl/templates/versions/8/audit-up.sql
@@ -1,26 +1,107 @@
-CREATE TABLE audit.sponsors (
+CREATE TABLE audit.cached_reports (
audit_op CHAR(1) NOT NULL CHECK (audit_op IN ('D','I','U')),
audit_user TEXT NOT NULL,
audit_stamp TIMESTAMP NOT NULL,
audit_txid INTEGER NOT NULL,
-id text,
-description text
+id character(36),
+report_class text,
+params text,
+expires timestamp without time zone
);
-GRANT SELECT ON audit.sponsors TO "[% ro_role %]";
-GRANT SELECT,INSERT ON audit.sponsors TO "[% rw_role %]";
-CREATE OR REPLACE FUNCTION public.process_sponsors_audit()
-RETURNS TRIGGER AS $sponsors_audit$
+GRANT SELECT ON audit.cached_reports TO "[% ro_role %]";
+GRANT SELECT,INSERT ON audit.cached_reports TO "[% rw_role %]";
+CREATE OR REPLACE FUNCTION public.process_cached_reports_audit()
+RETURNS TRIGGER AS $cached_reports_audit$
BEGIN
IF (TG_OP = 'DELETE') THEN
- INSERT INTO audit.sponsors SELECT 'D', user, now(), txid_current(), OLD.*;
+ INSERT INTO audit.cached_reports SELECT 'D', user, now(), txid_current(), OLD.*;
ELSIF (TG_OP = 'UPDATE') THEN
- INSERT INTO audit.sponsors SELECT 'U', user, now(), txid_current(), NEW.*;
+ INSERT INTO audit.cached_reports SELECT 'U', user, now(), txid_current(), NEW.*;
ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO audit.sponsors SELECT 'I', user, now(), txid_current(), NEW.*;
+ INSERT INTO audit.cached_reports SELECT 'I', user, now(), txid_current(), NEW.*;
END IF;
RETURN NULL;
END;
-$sponsors_audit$ LANGUAGE plpgsql;
-CREATE TRIGGER sponsors_audit
-AFTER INSERT OR UPDATE OR DELETE ON public.sponsors
- FOR EACH ROW EXECUTE PROCEDURE public.process_sponsors_audit();
+$cached_reports_audit$ LANGUAGE plpgsql;
+CREATE TRIGGER cached_reports_audit
+AFTER INSERT OR UPDATE OR DELETE ON public.cached_reports
+ FOR EACH ROW EXECUTE PROCEDURE public.process_cached_reports_audit();
+CREATE TABLE audit.targeting_type (
+audit_op CHAR(1) NOT NULL CHECK (audit_op IN ('D','I','U')),
+audit_user TEXT NOT NULL,
+audit_stamp TIMESTAMP NOT NULL,
+audit_txid INTEGER NOT NULL,
+id integer,
+targeting_type text
+);
+GRANT SELECT ON audit.targeting_type TO "[% ro_role %]";
+GRANT SELECT,INSERT ON audit.targeting_type TO "[% rw_role %]";
+CREATE OR REPLACE FUNCTION public.process_targeting_type_audit()
+RETURNS TRIGGER AS $targeting_type_audit$
+ BEGIN
+ IF (TG_OP = 'DELETE') THEN
+ INSERT INTO audit.targeting_type SELECT 'D', user, now(), txid_current(), OLD.*;
+ ELSIF (TG_OP = 'UPDATE') THEN
+ INSERT INTO audit.targeting_type SELECT 'U', user, now(), txid_current(), NEW.*;
+ ELSIF (TG_OP = 'INSERT') THEN
+ INSERT INTO audit.targeting_type SELECT 'I', user, now(), txid_current(), NEW.*;
+ END IF;
+ RETURN NULL;
+ END;
+$targeting_type_audit$ LANGUAGE plpgsql;
+CREATE TRIGGER targeting_type_audit
+AFTER INSERT OR UPDATE OR DELETE ON public.targeting_type
+ FOR EACH ROW EXECUTE PROCEDURE public.process_targeting_type_audit();
+CREATE TABLE audit.mutation_type (
+audit_op CHAR(1) NOT NULL CHECK (audit_op IN ('D','I','U')),
+audit_user TEXT NOT NULL,
+audit_stamp TIMESTAMP NOT NULL,
+audit_txid INTEGER NOT NULL,
+id integer,
+mutation_type text
+);
+GRANT SELECT ON audit.mutation_type TO "[% ro_role %]";
+GRANT SELECT,INSERT ON audit.mutation_type TO "[% rw_role %]";
+CREATE OR REPLACE FUNCTION public.process_mutation_type_audit()
+RETURNS TRIGGER AS $mutation_type_audit$
+ BEGIN
+ IF (TG_OP = 'DELETE') THEN
+ INSERT INTO audit.mutation_type SELECT 'D', user, now(), txid_current(), OLD.*;
+ ELSIF (TG_OP = 'UPDATE') THEN
+ INSERT INTO audit.mutation_type SELECT 'U', user, now(), txid_current(), NEW.*;
+ ELSIF (TG_OP = 'INSERT') THEN
+ INSERT INTO audit.mutation_type SELECT 'I', user, now(), txid_current(), NEW.*;
+ END IF;
+ RETURN NULL;
+ END;
+$mutation_type_audit$ LANGUAGE plpgsql;
+CREATE TRIGGER mutation_type_audit
+AFTER INSERT OR UPDATE OR DELETE ON public.mutation_type
+ FOR EACH ROW EXECUTE PROCEDURE public.process_mutation_type_audit();
+CREATE TABLE audit.final_cassette_function (
+audit_op CHAR(1) NOT NULL CHECK (audit_op IN ('D','I','U')),
+audit_user TEXT NOT NULL,
+audit_stamp TIMESTAMP NOT NULL,
+audit_txid INTEGER NOT NULL,
+id integer,
+final_cassette_function text
+);
+GRANT SELECT ON audit.final_cassette_function TO "[% ro_role %]";
+GRANT SELECT,INSERT ON audit.final_cassette_function TO "[% rw_role %]";
+CREATE OR REPLACE FUNCTION public.process_final_cassette_function_audit()
+RETURNS TRIGGER AS $final_cassette_function_audit$
+ BEGIN
+ IF (TG_OP = 'DELETE') THEN
+
+ INSERT INTO audit.final_cassette_function SELECT 'D', user, now(), txid_current(), OLD.*;
+ ELSIF (TG_OP = 'UPDATE') THEN
+ INSERT INTO audit.final_cassette_function SELECT 'U', user, now(), txid_current(), NEW.*;
+ ELSIF (TG_OP = 'INSERT') THEN
+ INSERT INTO audit.final_cassette_function SELECT 'I', user, now(), txid_current(), NEW.*;
+ END IF;
+ RETURN NULL;
+ END;
+$final_cassette_function_audit$ LANGUAGE plpgsql;
+CREATE TRIGGER final_cassette_function_audit
+AFTER INSERT OR UPDATE OR DELETE ON public.final_cassette_function
+ FOR EACH ROW EXECUTE PROCEDURE public.process_final_cassette_function_audit();
View
17 ddl/templates/versions/8/fixtures.sql
@@ -8,3 +8,20 @@ VALUES ('Core', 'Homozygous - Core'),
('Cre Knockin', 'EUCOMMTools-Cre Knockin'),
('Cre BAC', 'EUCOMMTools-Cre BAC'),
('Human','Homozygous - Human');
+
+INSERT INTO mutation_type(mutation_type)
+VALUES ('conditional'),
+ ('deletion'),
+ ('insertion');
+
+INSERT INTO targeting_type(targeting_type)
+VALUES ('single_targeting'),
+ ('double_targeting'),
+ ('modified_bac_insertion');
+
+INSERT INTO final_cassette_function(final_cassette_function)
+VALUES ('knockout_first'),
+ ('reporter_only'),
+ ('conditional_only'),
+ ('cre_expressor'),
+ ('promoterless_cre_expressor');
View
21 ddl/templates/versions/8/up.sql
@@ -8,3 +8,24 @@ CREATE TABLE sponsors (
);
GRANT SELECT ON sponsors TO "[% ro_role %]";
GRANT SELECT, INSERT, UPDATE, DELETE ON sponsors TO "[% rw_role %]";
+
+CREATE TABLE mutation_type (
+ id SERIAL PRIMARY KEY,
+ mutation_type TEXT NOT NULL
+);
+GRANT SELECT ON mutation_type TO "[% ro_role %]";
+GRANT SELECT, INSERT, UPDATE, DELETE ON mutation_type TO "[% rw_role %]";
+
+CREATE TABLE targeting_type (
+ id SERIAL PRIMARY KEY,
+ targeting_type TEXT NOT NULL
+);
+GRANT SELECT ON targeting_type TO "[% ro_role %]";
+GRANT SELECT, INSERT, UPDATE, DELETE ON targeting_type TO "[% rw_role %]";
+
+CREATE TABLE final_cassette_function (
+ id SERIAL PRIMARY KEY,
+ final_cassette_function TEXT NOT NULL
+);
+GRANT SELECT ON final_cassette_function TO "[% ro_role %]";
+GRANT SELECT, INSERT, UPDATE, DELETE ON final_cassette_function TO "[% rw_role %]";
View
118 lib/LIMS2/Model/Schema/Result/CachedReport.pm
@@ -0,0 +1,118 @@
+use utf8;
+package LIMS2::Model::Schema::Result::CachedReport;
+
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
+=head1 NAME
+
+LIMS2::Model::Schema::Result::CachedReport
+
+=cut
+
+use strict;
+use warnings;
+
+use Moose;
+use MooseX::NonMoose;
+use MooseX::MarkAsMethods autoclean => 1;
+extends 'DBIx::Class::Core';
+
+=head1 COMPONENTS LOADED
+
+=over 4
+
+=item * L<DBIx::Class::InflateColumn::DateTime>
+
+=back
+
+=cut
+
+__PACKAGE__->load_components("InflateColumn::DateTime");
+
+=head1 TABLE: C<cached_reports>
+
+=cut
+
+__PACKAGE__->table("cached_reports");
+
+=head1 ACCESSORS
+
+=head2 id
+
+ data_type: 'char'
+ is_nullable: 0
+ size: 36
+
+=head2 report_class
+
+ data_type: 'text'
+ is_nullable: 0
+
+=head2 params
+
+ data_type: 'text'
+ is_nullable: 0
+
+=head2 expires
+
+ data_type: 'timestamp'
+ default_value: (now() + '08:00:00'::interval)
+ is_nullable: 0
+
+=cut
+
+__PACKAGE__->add_columns(
+ "id",
+ { data_type => "char", is_nullable => 0, size => 36 },
+ "report_class",
+ { data_type => "text", is_nullable => 0 },
+ "params",
+ { data_type => "text", is_nullable => 0 },
+ "expires",
+ {
+ data_type => "timestamp",
+ default_value => \"(now() + '08:00:00'::interval)",
+ is_nullable => 0,
+ },
+);
+
+=head1 PRIMARY KEY
+
+=over 4
+
+=item * L</id>
+
+=back
+
+=cut
+
+__PACKAGE__->set_primary_key("id");
+
+=head1 UNIQUE CONSTRAINTS
+
+=head2 C<cached_reports_report_class_params_key>
+
+=over 4
+
+=item * L</report_class>
+
+=item * L</params>
+
+=back
+
+=cut
+
+__PACKAGE__->add_unique_constraint(
+ "cached_reports_report_class_params_key",
+ ["report_class", "params"],
+);
+
+
+# Created by DBIx::Class::Schema::Loader v0.07022 @ 2012-07-26 18:16:11
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:L/KCszm7wcxQEDmoFTrhjw
+
+
+# You can replace this text with custom code or comments, and it will be preserved on regeneration
+__PACKAGE__->meta->make_immutable;
+1;
View
86 lib/LIMS2/Model/Schema/Result/FinalCassetteFunction.pm
@@ -0,0 +1,86 @@
+use utf8;
+package LIMS2::Model::Schema::Result::FinalCassetteFunction;
+
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
+=head1 NAME
+
+LIMS2::Model::Schema::Result::FinalCassetteFunction
+
+=cut
+
+use strict;
+use warnings;
+
+use Moose;
+use MooseX::NonMoose;
+use MooseX::MarkAsMethods autoclean => 1;
+extends 'DBIx::Class::Core';
+
+=head1 COMPONENTS LOADED
+
+=over 4
+
+=item * L<DBIx::Class::InflateColumn::DateTime>
+
+=back
+
+=cut
+
+__PACKAGE__->load_components("InflateColumn::DateTime");
+
+=head1 TABLE: C<final_cassette_function>
+
+=cut
+
+__PACKAGE__->table("final_cassette_function");
+
+=head1 ACCESSORS
+
+=head2 id
+
+ data_type: 'integer'
+ is_auto_increment: 1
+ is_nullable: 0
+ sequence: 'final_cassette_function_id_seq'
+
+=head2 final_cassette_function
+
+ data_type: 'text'
+ is_nullable: 0
+
+=cut
+
+__PACKAGE__->add_columns(
+ "id",
+ {
+ data_type => "integer",
+ is_auto_increment => 1,
+ is_nullable => 0,
+ sequence => "final_cassette_function_id_seq",
+ },
+ "final_cassette_function",
+ { data_type => "text", is_nullable => 0 },
+);
+
+=head1 PRIMARY KEY
+
+=over 4
+
+=item * L</id>
+
+=back
+
+=cut
+
+__PACKAGE__->set_primary_key("id");
+
+
+# Created by DBIx::Class::Schema::Loader v0.07022 @ 2012-07-26 18:16:11
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Sm2U7YGQtukaIakhQTwYrw
+
+
+# You can replace this text with custom code or comments, and it will be preserved on regeneration
+__PACKAGE__->meta->make_immutable;
+1;
View
86 lib/LIMS2/Model/Schema/Result/MutationType.pm
@@ -0,0 +1,86 @@
+use utf8;
+package LIMS2::Model::Schema::Result::MutationType;
+
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
+=head1 NAME
+
+LIMS2::Model::Schema::Result::MutationType
+
+=cut
+
+use strict;
+use warnings;
+
+use Moose;
+use MooseX::NonMoose;
+use MooseX::MarkAsMethods autoclean => 1;
+extends 'DBIx::Class::Core';
+
+=head1 COMPONENTS LOADED
+
+=over 4
+
+=item * L<DBIx::Class::InflateColumn::DateTime>
+
+=back
+
+=cut
+
+__PACKAGE__->load_components("InflateColumn::DateTime");
+
+=head1 TABLE: C<mutation_type>
+
+=cut
+
+__PACKAGE__->table("mutation_type");
+
+=head1 ACCESSORS
+
+=head2 id
+
+ data_type: 'integer'
+ is_auto_increment: 1
+ is_nullable: 0
+ sequence: 'mutation_type_id_seq'
+
+=head2 mutation_type
+
+ data_type: 'text'
+ is_nullable: 0
+
+=cut
+
+__PACKAGE__->add_columns(
+ "id",
+ {
+ data_type => "integer",
+ is_auto_increment => 1,
+ is_nullable => 0,
+ sequence => "mutation_type_id_seq",
+ },
+ "mutation_type",
+ { data_type => "text", is_nullable => 0 },
+);
+
+=head1 PRIMARY KEY
+
+=over 4
+
+=item * L</id>
+
+=back
+
+=cut
+
+__PACKAGE__->set_primary_key("id");
+
+
+# Created by DBIx::Class::Schema::Loader v0.07022 @ 2012-07-26 18:16:11
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0ECTVXn/A33ZYuwQUmWHjQ
+
+
+# You can replace this text with custom code or comments, and it will be preserved on regeneration
+__PACKAGE__->meta->make_immutable;
+1;
View
86 lib/LIMS2/Model/Schema/Result/TargetingType.pm
@@ -0,0 +1,86 @@
+use utf8;
+package LIMS2::Model::Schema::Result::TargetingType;
+
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
+=head1 NAME
+
+LIMS2::Model::Schema::Result::TargetingType
+
+=cut
+
+use strict;
+use warnings;
+
+use Moose;
+use MooseX::NonMoose;
+use MooseX::MarkAsMethods autoclean => 1;
+extends 'DBIx::Class::Core';
+
+=head1 COMPONENTS LOADED
+
+=over 4
+
+=item * L<DBIx::Class::InflateColumn::DateTime>
+
+=back
+
+=cut
+
+__PACKAGE__->load_components("InflateColumn::DateTime");
+
+=head1 TABLE: C<targeting_type>
+
+=cut
+
+__PACKAGE__->table("targeting_type");
+
+=head1 ACCESSORS
+
+=head2 id
+
+ data_type: 'integer'
+ is_auto_increment: 1
+ is_nullable: 0
+ sequence: 'targeting_type_id_seq'
+
+=head2 targeting_type
+
+ data_type: 'text'
+ is_nullable: 0
+
+=cut
+
+__PACKAGE__->add_columns(
+ "id",
+ {
+ data_type => "integer",
+ is_auto_increment => 1,
+ is_nullable => 0,
+ sequence => "targeting_type_id_seq",
+ },
+ "targeting_type",
+ { data_type => "text", is_nullable => 0 },
+);
+
+=head1 PRIMARY KEY
+
+=over 4
+
+=item * L</id>
+
+=back
+
+=cut
+
+__PACKAGE__->set_primary_key("id");
+
+
+# Created by DBIx::Class::Schema::Loader v0.07022 @ 2012-07-26 18:16:11
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5iD0EH9MhlnZxjQ0NFCHIg
+
+
+# You can replace this text with custom code or comments, and it will be preserved on regeneration
+__PACKAGE__->meta->make_immutable;
+1;

0 comments on commit d97bf86

Please sign in to comment.