--- /dev/null
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::AuthMasterRight;
+
+use strict;
+
+use SL::DB::MetaSetup::AuthMasterRight;
+use SL::DB::Manager::AuthMasterRight;
+
+__PACKAGE__->meta->initialize;
+
+1;
--- /dev/null
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::AuthSchemaInfo;
+
+use strict;
+
+use SL::DB::MetaSetup::AuthSchemaInfo;
+use SL::DB::Manager::AuthSchemaInfo;
+
+__PACKAGE__->meta->initialize;
+
+1;
--- /dev/null
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::AuthSession;
+
+use strict;
+
+use SL::DB::MetaSetup::AuthSession;
+use SL::DB::Manager::AuthSession;
+
+__PACKAGE__->meta->initialize;
+
+1;
--- /dev/null
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::AuthSessionContent;
+
+use strict;
+
+use SL::DB::MetaSetup::AuthSessionContent;
+use SL::DB::Manager::AuthSessionContent;
+
+__PACKAGE__->meta->initialize;
+
+1;
'auth.clients_groups' => 'auth_client_group',
'auth.group' => 'auth_group',
'auth.group_rights' => 'auth_group_right',
+ 'auth.master_rights' => 'auth_master_right',
+ 'auth.schema_info' => 'auth_schema_info',
+ 'auth.session' => 'auth_session',
+ 'auth.session_content' => 'auth_session_content',
'auth.user' => 'auth_user',
'auth.user_config' => 'auth_user_config',
'auth.user_group' => 'auth_user_group',
--- /dev/null
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Manager::AuthMasterRight;
+
+use strict;
+
+use parent qw(SL::DB::Helper::Manager);
+
+sub object_class { 'SL::DB::AuthMasterRight' }
+
+__PACKAGE__->make_manager_methods;
+
+1;
--- /dev/null
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Manager::AuthSchemaInfo;
+
+use strict;
+
+use parent qw(SL::DB::Helper::Manager);
+
+sub object_class { 'SL::DB::AuthSchemaInfo' }
+
+__PACKAGE__->make_manager_methods;
+
+1;
--- /dev/null
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Manager::AuthSession;
+
+use strict;
+
+use parent qw(SL::DB::Helper::Manager);
+
+sub object_class { 'SL::DB::AuthSession' }
+
+__PACKAGE__->make_manager_methods;
+
+1;
--- /dev/null
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Manager::AuthSessionContent;
+
+use strict;
+
+use parent qw(SL::DB::Helper::Manager);
+
+sub object_class { 'SL::DB::AuthSessionContent' }
+
+__PACKAGE__->make_manager_methods;
+
+1;
use strict;
-use base qw(SL::DB::Object);
+use parent qw(SL::DB::Object);
__PACKAGE__->meta->table('clients');
__PACKAGE__->meta->schema('auth');
__PACKAGE__->meta->columns(
- id => { type => 'serial', not_null => 1 },
- name => { type => 'text', not_null => 1 },
dbhost => { type => 'text', not_null => 1 },
- dbport => { type => 'integer', default => 5432, not_null => 1 },
dbname => { type => 'text', not_null => 1 },
- dbuser => { type => 'text', not_null => 1 },
dbpasswd => { type => 'text', not_null => 1 },
+ dbport => { type => 'integer', default => 5432, not_null => 1 },
+ dbuser => { type => 'text', not_null => 1 },
+ id => { type => 'serial', not_null => 1 },
is_default => { type => 'boolean', default => 'false', not_null => 1 },
+ name => { type => 'text', not_null => 1 },
);
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
[ 'name' ],
);
-# __PACKAGE__->meta->initialize;
-
1;
;
use strict;
-use base qw(SL::DB::Object);
+use parent qw(SL::DB::Object);
__PACKAGE__->meta->table('clients_groups');
__PACKAGE__->meta->schema('auth');
},
);
-# __PACKAGE__->meta->initialize;
-
1;
;
use strict;
-use base qw(SL::DB::Object);
+use parent qw(SL::DB::Object);
__PACKAGE__->meta->table('clients_users');
__PACKAGE__->meta->schema('auth');
},
);
-# __PACKAGE__->meta->initialize;
-
1;
;
use strict;
-use base qw(SL::DB::Object);
+use parent qw(SL::DB::Object);
__PACKAGE__->meta->table('group');
__PACKAGE__->meta->schema('auth');
__PACKAGE__->meta->columns(
+ description => { type => 'text' },
id => { type => 'serial', not_null => 1 },
name => { type => 'text', not_null => 1 },
- description => { type => 'text' },
);
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
__PACKAGE__->meta->unique_keys([ 'name' ]);
-# __PACKAGE__->meta->initialize;
-
1;
;
use strict;
-use base qw(SL::DB::Object);
+use parent qw(SL::DB::Object);
__PACKAGE__->meta->table('group_rights');
__PACKAGE__->meta->schema('auth');
__PACKAGE__->meta->columns(
+ granted => { type => 'boolean', not_null => 1 },
group_id => { type => 'integer', not_null => 1 },
right => { type => 'text', not_null => 1 },
- granted => { type => 'boolean', not_null => 1 },
);
__PACKAGE__->meta->primary_key_columns([ 'group_id', 'right' ]);
},
);
-# __PACKAGE__->meta->initialize;
-
1;
;
--- /dev/null
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::AuthMasterRight;
+
+use strict;
+
+use parent qw(SL::DB::Object);
+
+__PACKAGE__->meta->table('master_rights');
+__PACKAGE__->meta->schema('auth');
+
+__PACKAGE__->meta->columns(
+ category => { type => 'boolean', default => 'false', not_null => 1 },
+ description => { type => 'text', not_null => 1 },
+ id => { type => 'serial', not_null => 1 },
+ name => { type => 'text', not_null => 1 },
+ position => { type => 'integer', not_null => 1 },
+);
+
+__PACKAGE__->meta->primary_key_columns([ 'id' ]);
+
+__PACKAGE__->meta->unique_keys([ 'name' ]);
+
+1;
+;
--- /dev/null
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::AuthSchemaInfo;
+
+use strict;
+
+use parent qw(SL::DB::Object);
+
+__PACKAGE__->meta->table('schema_info');
+__PACKAGE__->meta->schema('auth');
+
+__PACKAGE__->meta->columns(
+ itime => { type => 'timestamp', default => 'now()' },
+ login => { type => 'text' },
+ tag => { type => 'text', not_null => 1 },
+);
+
+__PACKAGE__->meta->primary_key_columns([ 'tag' ]);
+
+__PACKAGE__->meta->allow_inline_column_values(1);
+
+1;
+;
--- /dev/null
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::AuthSession;
+
+use strict;
+
+use parent qw(SL::DB::Object);
+
+__PACKAGE__->meta->table('session');
+__PACKAGE__->meta->schema('auth');
+
+__PACKAGE__->meta->columns(
+ api_token => { type => 'text' },
+ id => { type => 'text', not_null => 1 },
+ ip_address => { type => 'scalar' },
+ mtime => { type => 'timestamp' },
+);
+
+__PACKAGE__->meta->primary_key_columns([ 'id' ]);
+
+1;
+;
--- /dev/null
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::AuthSessionContent;
+
+use strict;
+
+use parent qw(SL::DB::Object);
+
+__PACKAGE__->meta->table('session_content');
+__PACKAGE__->meta->schema('auth');
+
+__PACKAGE__->meta->columns(
+ auto_restore => { type => 'boolean' },
+ sess_key => { type => 'text', not_null => 1 },
+ sess_value => { type => 'text' },
+ session_id => { type => 'text', not_null => 1 },
+);
+
+__PACKAGE__->meta->primary_key_columns([ 'session_id', 'sess_key' ]);
+
+1;
+;
use strict;
-use base qw(SL::DB::Object);
+use parent qw(SL::DB::Object);
__PACKAGE__->meta->table('user');
__PACKAGE__->meta->schema('auth');
__PACKAGE__->meta->unique_keys([ 'login' ]);
-# __PACKAGE__->meta->initialize;
-
1;
;
use strict;
-use base qw(SL::DB::Object);
+use parent qw(SL::DB::Object);
__PACKAGE__->meta->table('user_config');
__PACKAGE__->meta->schema('auth');
__PACKAGE__->meta->columns(
- user_id => { type => 'integer', not_null => 1 },
cfg_key => { type => 'text', not_null => 1 },
cfg_value => { type => 'text' },
+ user_id => { type => 'integer', not_null => 1 },
);
__PACKAGE__->meta->primary_key_columns([ 'user_id', 'cfg_key' ]);
},
);
-# __PACKAGE__->meta->initialize;
-
1;
;
use strict;
-use base qw(SL::DB::Object);
+use parent qw(SL::DB::Object);
__PACKAGE__->meta->table('user_group');
__PACKAGE__->meta->schema('auth');
__PACKAGE__->meta->columns(
- user_id => { type => 'integer', not_null => 1 },
group_id => { type => 'integer', not_null => 1 },
+ user_id => { type => 'integer', not_null => 1 },
);
__PACKAGE__->meta->primary_key_columns([ 'user_id', 'group_id' ]);
},
);
-# __PACKAGE__->meta->initialize;
-
1;
;
use Digest::MD5 qw(md5_hex);
use English qw( -no_match_vars );
use Getopt::Long;
-use List::MoreUtils qw(none);
+use List::MoreUtils qw(apply none uniq);
use List::UtilsBy qw(partition_by);
use Pod::Usage;
use Rose::DB::Object 0.809;
pod2usage(verbose => 99, sections => 'SYNOPSIS');
}
+sub list_all_tables {
+ my ($db) = @_;
+
+ my @schemas = (undef, uniq apply { s{\..*}{} } grep { m{\.} } keys %{ $package_names{KIVITENDO} });
+ my @tables;
+
+ foreach my $schema (@schemas) {
+ $db->schema($schema);
+ push @tables, map { $schema ? "${schema}.${_}" : $_ } $db->list_tables;
+ }
+
+ $db->schema(undef);
+
+ return @tables;
+}
+
sub make_tables {
my %tables_by_domain;
if ($config{all}) {
foreach my $domain (@domains) {
my $db = SL::DB::create(undef, $domain);
- $tables_by_domain{$domain} = [ grep { my $table = $_; none { $_ eq $table } @{ $blacklist{$domain} } } $db->list_tables ];
+ $tables_by_domain{$domain} = [ grep { my $table = $_; none { $_ eq $table } @{ $blacklist{$domain} } } list_all_tables($db) ];
$db->disconnect;
}
--- /dev/null
+-- @tag: session_content_primary_key
+-- @description: Primärschlüssel für Tabelle auth.session_content
+-- @depends: release_3_3_0
+ALTER TABLE auth.session_content ADD PRIMARY KEY (session_id, sess_key);