Permalink
Browse files

load a working minimal DB from scratch, equivalent to http://socorro.…

  • Loading branch information...
1 parent 42bf239 commit 6bdb290cb1ca1d81e75a7bd1bd9f653206ae2da1 @rhelmer committed Jan 5, 2012
Showing with 11 additions and 27 deletions.
  1. +11 −27 manifests/classes/socorro-db.pp
@@ -34,14 +34,12 @@
creates => '/etc/apt/sources.list.d/pitti-postgresql-lucid.list',
require => Package['python-software-properties'];
- # FIXME hardcoded 2.2
- '/usr/bin/psql -f /home/socorro/dev/socorro/sql/schema/2.2/breakpad_roles.sql breakpad':
+ '/usr/bin/psql -f /home/socorro/dev/socorro/sql/schema/2.3/breakpad_roles.sql breakpad':
alias => 'create-breakpad-roles',
user => 'postgres',
require => [Exec['create-breakpad-db'], Exec['socorro-clone']];
- # FIXME hardcoded 2.2
- '/usr/bin/psql -f /home/socorro/dev/socorro/sql/schema/2.2/breakpad_schema.sql breakpad':
+ '/usr/bin/psql -f /home/socorro/dev/socorro/sql/schema/2.3/breakpad_schema.sql breakpad':
alias => 'setup-schema',
user => 'postgres',
require => [Exec['create-breakpad-roles'], Exec['socorro-clone']],
@@ -78,37 +76,23 @@
}
exec {
- '/usr/bin/psql -c "CREATE TABLE sessions ( session_id varchar(127) NOT NULL, last_activity integer NOT NULL, data text NOT NULL, CONSTRAINT session_id_pkey PRIMARY KEY (session_id), CONSTRAINT last_activity_check CHECK (last_activity >= 0))" breakpad':
- alias => 'create-sessions-table',
- user => 'postgres',
- unless => '/usr/bin/psql -c "SELECT relname from pg_class where relname = \'sessions\'" breakpad | grep sessions',
- require => Exec['create-language-plperl'];
- }
-
- exec {
- '/usr/bin/psql -c "ALTER TABLE sessions OWNER TO breakpad_rw" breakpad':
- alias => 'alter-sessions-table',
- user => 'postgres',
- require => [Exec['create-sessions-table'], Exec['create-breakpad-roles']];
- }
-
- exec {
- '/usr/bin/psql -c "INSERT INTO productdims (product, version, branch) values (\'GenericProduct\', \'1.0\', \'1.0\')" breakpad':
- alias => 'insert-productdims',
- unless => '/usr/bin/psql -c "select id from productdims where id = \'1\'" breakpad | grep " 1"',
+ '/bin/bash /home/socorro/dev/socorro/tools/dataload/import.sh':
+ alias => 'dataload',
user => 'postgres',
+ cwd => '/home/socorro/dev/socorro/tools/dataload/',
+ onlyif => '/usr/bin/psql -xt breakpad -c "SELECT count(*) FROM reports" | grep "count | 0"',
+ logoutput => on_failure,
require => Exec['setup-schema'];
}
exec {
- '/usr/bin/psql -c "INSERT INTO product_visibility (productdims_id, start_date, end_date, featured) VALUES (1, \'2010-11-05\', \'2015-02-05\', true)" breakpad':
- alias => 'insert-product_visibility',
- unless => '/usr/bin/psql -c "select productdims_id from product_visibility where productdims_id = \'1\'" breakpad | grep " 1"',
+ '/usr/bin/psql -c "SELECT backfill_matviews(\'2012-01-02\', \'2012-01-03\'); UPDATE product_versions SET featured_version = true" breakpad':
+ alias => 'bootstrap-matviews',
user => 'postgres',
- require => Exec['insert-productdims'];
+ onlyif => '/usr/bin/psql -xt breakpad -c "SELECT count(*) FROM product_versions" | grep "count | 0"',
+ require => Exec['dataload'];
}
-
exec {
'/usr/bin/createdb test':
require => Package['postgresql'],

0 comments on commit 6bdb290

Please sign in to comment.