... | ... |
@@ -47,7 +47,7 @@ If you used Gitprep version 1 from now, you need upgrade database. |
47 | 47 |
|
48 | 48 |
mv data/gitprep.db data/gitprep_v1bak.db |
49 | 49 |
./setup_database |
50 |
- ./copy_database_v1_to_v2 data/gitprep_v1bak.db data/gitprep.db |
|
50 |
+ old/copy_database_v1_to_v2 data/gitprep_v1bak.db data/gitprep.db |
|
51 | 51 |
|
52 | 52 |
If you install git in your local directry, |
53 | 53 |
you must add the correct git command path to the **gitprep.conf** config file. |
... | ... |
@@ -564,7 +564,6 @@ EOS |
564 | 564 |
# Create pull_request columns |
565 | 565 |
my @pull_request_columns = ( |
566 | 566 |
"title not null default ''", |
567 |
- "message not null default ''", |
|
568 | 567 |
"open integer default 0", |
569 | 568 |
"open_time integer default 0", |
570 | 569 |
"open_user integer default 0" |
... | ... |
@@ -574,39 +573,12 @@ EOS |
574 | 573 |
} |
575 | 574 |
|
576 | 575 |
# Check pull_request table |
577 |
- eval { $dbi->select([qw/row_id project branch1 branch2 title message open open_time open_user/], table => 'pull_request') }; |
|
576 |
+ eval { $dbi->select([qw/row_id project branch1 branch2 title open open_time open_user/], table => 'pull_request') }; |
|
578 | 577 |
if ($@) { |
579 | 578 |
my $error = "Can't create pull_request table properly: $@"; |
580 | 579 |
$self->app->log->error($error); |
581 | 580 |
croak $error; |
582 | 581 |
} |
583 |
- |
|
584 |
- # Create number table |
|
585 |
- eval { |
|
586 |
- my $sql = <<"EOS"; |
|
587 |
-create table number ( |
|
588 |
- row_id integer primary key autoincrement, |
|
589 |
- key not null unique |
|
590 |
-); |
|
591 |
-EOS |
|
592 |
- $dbi->execute($sql); |
|
593 |
- }; |
|
594 |
- |
|
595 |
- # Create number columns |
|
596 |
- my $number_columns = [ |
|
597 |
- "value integer not null default '0'" |
|
598 |
- ]; |
|
599 |
- for my $column (@$number_columns) { |
|
600 |
- eval { $dbi->execute("alter table number add column $column") }; |
|
601 |
- } |
|
602 |
- |
|
603 |
- # Check number table |
|
604 |
- eval { $dbi->select([qw/row_id key value/], table => 'number') }; |
|
605 |
- if ($@) { |
|
606 |
- my $error = "Can't create number table properly: $@"; |
|
607 |
- $self->app->log->error($error); |
|
608 |
- croak $error; |
|
609 |
- } |
|
610 | 582 |
} |
611 | 583 |
|
612 | 584 |
=pod |
... | ... |
@@ -0,0 +1,38 @@ |
1 |
+#!/usr/bin/env perl |
|
2 |
+ |
|
3 |
+use FindBin; |
|
4 |
+use lib "$FindBin::Bin/../extlib/lib/perl5"; |
|
5 |
+use DBIx::Custom; |
|
6 |
+ |
|
7 |
+my ($old_database_file, $new_database_file) = @ARGV; |
|
8 |
+ |
|
9 |
+# Old DBI |
|
10 |
+my %old_dbi_args = ( |
|
11 |
+ dsn => "dbi:SQLite:database=$old_database_file", |
|
12 |
+ connector => 1, |
|
13 |
+ option => {sqlite_unicode => 1, sqlite_use_immediate_transaction => 1} |
|
14 |
+); |
|
15 |
+my $old_dbi = DBIx::Custom->connect(%old_dbi_args); |
|
16 |
+ |
|
17 |
+# New DBI |
|
18 |
+my %new_dbi_args = ( |
|
19 |
+ dsn => "dbi:SQLite:database=$new_database_file", |
|
20 |
+ connector => 1, |
|
21 |
+ option => {sqlite_unicode => 1, sqlite_use_immediate_transaction => 1} |
|
22 |
+); |
|
23 |
+my $new_dbi = DBIx::Custom->connect(%new_dbi_args); |
|
24 |
+ |
|
25 |
+# Copy number data |
|
26 |
+my $numbers = $old_dbi->select(table => 'number')->all; |
|
27 |
+for my $number (@$numbers) { |
|
28 |
+ $new_dbi->insert($number, table => 'number'); |
|
29 |
+} |
|
30 |
+ |
|
31 |
+=pod |
|
32 |
+collaboration |
|
33 |
+number |
|
34 |
+project |
|
35 |
+pull_request |
|
36 |
+ssh_public_key |
|
37 |
+user |
|
38 |
+=cut |