diff options
author | franck cuny <franck@lumberjaph.net> | 2011-02-14 21:28:08 +0100 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2011-02-14 21:28:08 +0100 |
commit | a1f9ccf014f999255f0b5bcbd6cc6be1fcbb7e25 (patch) | |
tree | e3fcb5c999b4b3dc1a972730d3767d5e2d5dd0ed | |
parent | script to deploy and migrate DB schema (diff) | |
download | jitterbug-a1f9ccf014f999255f0b5bcbd6cc6be1fcbb7e25.tar.gz |
remove useless scripts
Diffstat (limited to '')
-rw-r--r-- | scripts/deploy_schema | 14 | ||||
-rw-r--r-- | scripts/migrate_from_redis.pl | 41 | ||||
-rwxr-xr-x | scripts/upgrade_db.pl | 55 |
3 files changed, 0 insertions, 110 deletions
diff --git a/scripts/deploy_schema b/scripts/deploy_schema deleted file mode 100644 index aa31811..0000000 --- a/scripts/deploy_schema +++ /dev/null @@ -1,14 +0,0 @@ -use strict; -use warnings; -use jitterbug::Schema; -use YAML qw/LoadFile/; - -my $config = shift; -die "need configuration file" unless $config; - -my $dancer_conf = LoadFile($config); - -my $dbix_conf = $dancer_conf->{plugins}->{DBIC}->{schema}; -my $schema = jitterbug::Schema->connect( @{ $dbix_conf->{connect_info} } ); -$schema->deploy; -print "done!\n"; \ No newline at end of file diff --git a/scripts/migrate_from_redis.pl b/scripts/migrate_from_redis.pl deleted file mode 100644 index 61490c1..0000000 --- a/scripts/migrate_from_redis.pl +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; - -use jitterbug::Schema; - -use YAML qw/LoadFile/; -use JSON; - -my $conf = shift || die "config is missing"; -my $data = shift || die "data is missing"; - -$conf = LoadFile($conf); -$data = LoadFile($data); - -my $schema = jitterbug::Schema->connect( - @{ $conf->{plugins}->{DBIC}->{schema}->{connect_info} } ); - -my $project = $schema->resultset('Project')->create( - { - name => $data->{desc}->{name}, - url => $data->{desc}->{url}, - description => $data->{desc}->{description}, - owner => JSON::encode_json( $data->{desc}->{owner} ), - } -); - -foreach my $build ( @{ $data->{builds} } ) { - my $sha256 = delete $build->{commit}; - my $timestamp = $build->{timestamp}; - my $tests = delete $build->{version}; - $build->{build}->{version} = $tests; - $schema->resultset('Commit')->create( - { - sha256 => $sha256, - projectid => $project->projectid, - timestamp => $timestamp, - content => JSON::encode_json($build), - } - ); -} diff --git a/scripts/upgrade_db.pl b/scripts/upgrade_db.pl deleted file mode 100755 index 629ef25..0000000 --- a/scripts/upgrade_db.pl +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; - -use lib 'lib'; - -use YAML qw/LoadFile/; -use DBIx::Class::DeploymentHandler; -use SQL::Translator; - -my $config = shift; -die "need configuration file" unless $config; - -my $schema = 'jitterbug::Schema'; - -my $version = eval "use $schema; $schema->VERSION" or die $@; - -print "processing version $version of $schema...\n"; - -my $jitterbug_conf = LoadFile($config); -my $dbix_conf = $jitterbug_conf->{plugins}->{DBIC}->{schema}; -my $s = $schema->connect( @{ $dbix_conf->{connect_info} } ); - -my $dh = DBIx::Class::DeploymentHandler->new( - { - schema => $s, - databases => [qw/ SQLite PostgreSQL MySQL /], - sql_translator_args => { add_drop_table => 0, }, - } -); - -print "generating deployment script\n"; -$dh->prepare_install; - -if ( $version > 1 ) { - print "generating upgrade script\n"; - $dh->prepare_upgrade( - { - from_version => $version - 1, - to_version => $version, - version_set => [ $version - 1, $version ], - } - ); - - print "generating downgrade script\n"; - $dh->prepare_downgrade( - { - from_version => $version, - to_version => $version - 1, - version_set => [ $version, $version - 1 ], - } - ); -} - -print "done\n"; |