Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d2c5f647

Von Moritz Bunkus vor etwa 9 Jahren hinzugefügt

  • ID d2c5f6474ebd578ce46e09484780cfea556abb5e
  • Vorgänger 1cc7b9e6
  • Nachfolger 20d730ac

rose_auto_create_model.pl: --all behandelt auch auth-Tabellen

Unterschiede anzeigen:

SL/DB/AuthMasterRight.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4
package SL::DB::AuthMasterRight;
5

  
6
use strict;
7

  
8
use SL::DB::MetaSetup::AuthMasterRight;
9
use SL::DB::Manager::AuthMasterRight;
10

  
11
__PACKAGE__->meta->initialize;
12

  
13
1;
SL/DB/AuthSchemaInfo.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4
package SL::DB::AuthSchemaInfo;
5

  
6
use strict;
7

  
8
use SL::DB::MetaSetup::AuthSchemaInfo;
9
use SL::DB::Manager::AuthSchemaInfo;
10

  
11
__PACKAGE__->meta->initialize;
12

  
13
1;
SL/DB/AuthSession.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4
package SL::DB::AuthSession;
5

  
6
use strict;
7

  
8
use SL::DB::MetaSetup::AuthSession;
9
use SL::DB::Manager::AuthSession;
10

  
11
__PACKAGE__->meta->initialize;
12

  
13
1;
SL/DB/AuthSessionContent.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4
package SL::DB::AuthSessionContent;
5

  
6
use strict;
7

  
8
use SL::DB::MetaSetup::AuthSessionContent;
9
use SL::DB::Manager::AuthSessionContent;
10

  
11
__PACKAGE__->meta->initialize;
12

  
13
1;
SL/DB/Helper/Mappings.pm
89 89
  'auth.clients_groups'          => 'auth_client_group',
90 90
  'auth.group'                   => 'auth_group',
91 91
  'auth.group_rights'            => 'auth_group_right',
92
  'auth.master_rights'           => 'auth_master_right',
93
  'auth.schema_info'             => 'auth_schema_info',
94
  'auth.session'                 => 'auth_session',
95
  'auth.session_content'         => 'auth_session_content',
92 96
  'auth.user'                    => 'auth_user',
93 97
  'auth.user_config'             => 'auth_user_config',
94 98
  'auth.user_group'              => 'auth_user_group',
SL/DB/Manager/AuthMasterRight.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4
package SL::DB::Manager::AuthMasterRight;
5

  
6
use strict;
7

  
8
use parent qw(SL::DB::Helper::Manager);
9

  
10
sub object_class { 'SL::DB::AuthMasterRight' }
11

  
12
__PACKAGE__->make_manager_methods;
13

  
14
1;
SL/DB/Manager/AuthSchemaInfo.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4
package SL::DB::Manager::AuthSchemaInfo;
5

  
6
use strict;
7

  
8
use parent qw(SL::DB::Helper::Manager);
9

  
10
sub object_class { 'SL::DB::AuthSchemaInfo' }
11

  
12
__PACKAGE__->make_manager_methods;
13

  
14
1;
SL/DB/Manager/AuthSession.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4
package SL::DB::Manager::AuthSession;
5

  
6
use strict;
7

  
8
use parent qw(SL::DB::Helper::Manager);
9

  
10
sub object_class { 'SL::DB::AuthSession' }
11

  
12
__PACKAGE__->make_manager_methods;
13

  
14
1;
SL/DB/Manager/AuthSessionContent.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4
package SL::DB::Manager::AuthSessionContent;
5

  
6
use strict;
7

  
8
use parent qw(SL::DB::Helper::Manager);
9

  
10
sub object_class { 'SL::DB::AuthSessionContent' }
11

  
12
__PACKAGE__->make_manager_methods;
13

  
14
1;
SL/DB/MetaSetup/AuthClient.pm
4 4

  
5 5
use strict;
6 6

  
7
use base qw(SL::DB::Object);
7
use parent qw(SL::DB::Object);
8 8

  
9 9
__PACKAGE__->meta->table('clients');
10 10
__PACKAGE__->meta->schema('auth');
11 11

  
12 12
__PACKAGE__->meta->columns(
13
  id         => { type => 'serial', not_null => 1 },
14
  name       => { type => 'text', not_null => 1 },
15 13
  dbhost     => { type => 'text', not_null => 1 },
16
  dbport     => { type => 'integer', default => 5432, not_null => 1 },
17 14
  dbname     => { type => 'text', not_null => 1 },
18
  dbuser     => { type => 'text', not_null => 1 },
19 15
  dbpasswd   => { type => 'text', not_null => 1 },
16
  dbport     => { type => 'integer', default => 5432, not_null => 1 },
17
  dbuser     => { type => 'text', not_null => 1 },
18
  id         => { type => 'serial', not_null => 1 },
20 19
  is_default => { type => 'boolean', default => 'false', not_null => 1 },
20
  name       => { type => 'text', not_null => 1 },
21 21
);
22 22

  
23 23
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
......
27 27
  [ 'name' ],
28 28
);
29 29

  
30
# __PACKAGE__->meta->initialize;
31

  
32 30
1;
33 31
;
SL/DB/MetaSetup/AuthClientGroup.pm
4 4

  
5 5
use strict;
6 6

  
7
use base qw(SL::DB::Object);
7
use parent qw(SL::DB::Object);
8 8

  
9 9
__PACKAGE__->meta->table('clients_groups');
10 10
__PACKAGE__->meta->schema('auth');
......
28 28
  },
29 29
);
30 30

  
31
# __PACKAGE__->meta->initialize;
32

  
33 31
1;
34 32
;
SL/DB/MetaSetup/AuthClientUser.pm
4 4

  
5 5
use strict;
6 6

  
7
use base qw(SL::DB::Object);
7
use parent qw(SL::DB::Object);
8 8

  
9 9
__PACKAGE__->meta->table('clients_users');
10 10
__PACKAGE__->meta->schema('auth');
......
28 28
  },
29 29
);
30 30

  
31
# __PACKAGE__->meta->initialize;
32

  
33 31
1;
34 32
;
SL/DB/MetaSetup/AuthGroup.pm
4 4

  
5 5
use strict;
6 6

  
7
use base qw(SL::DB::Object);
7
use parent qw(SL::DB::Object);
8 8

  
9 9
__PACKAGE__->meta->table('group');
10 10
__PACKAGE__->meta->schema('auth');
11 11

  
12 12
__PACKAGE__->meta->columns(
13
  description => { type => 'text' },
13 14
  id          => { type => 'serial', not_null => 1 },
14 15
  name        => { type => 'text', not_null => 1 },
15
  description => { type => 'text' },
16 16
);
17 17

  
18 18
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
19 19

  
20 20
__PACKAGE__->meta->unique_keys([ 'name' ]);
21 21

  
22
# __PACKAGE__->meta->initialize;
23

  
24 22
1;
25 23
;
SL/DB/MetaSetup/AuthGroupRight.pm
4 4

  
5 5
use strict;
6 6

  
7
use base qw(SL::DB::Object);
7
use parent qw(SL::DB::Object);
8 8

  
9 9
__PACKAGE__->meta->table('group_rights');
10 10
__PACKAGE__->meta->schema('auth');
11 11

  
12 12
__PACKAGE__->meta->columns(
13
  granted  => { type => 'boolean', not_null => 1 },
13 14
  group_id => { type => 'integer', not_null => 1 },
14 15
  right    => { type => 'text', not_null => 1 },
15
  granted  => { type => 'boolean', not_null => 1 },
16 16
);
17 17

  
18 18
__PACKAGE__->meta->primary_key_columns([ 'group_id', 'right' ]);
......
24 24
  },
25 25
);
26 26

  
27
# __PACKAGE__->meta->initialize;
28

  
29 27
1;
30 28
;
SL/DB/MetaSetup/AuthMasterRight.pm
1
# This file has been auto-generated. Do not modify it; it will be overwritten
2
# by rose_auto_create_model.pl automatically.
3
package SL::DB::AuthMasterRight;
4

  
5
use strict;
6

  
7
use parent qw(SL::DB::Object);
8

  
9
__PACKAGE__->meta->table('master_rights');
10
__PACKAGE__->meta->schema('auth');
11

  
12
__PACKAGE__->meta->columns(
13
  category    => { type => 'boolean', default => 'false', not_null => 1 },
14
  description => { type => 'text', not_null => 1 },
15
  id          => { type => 'serial', not_null => 1 },
16
  name        => { type => 'text', not_null => 1 },
17
  position    => { type => 'integer', not_null => 1 },
18
);
19

  
20
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
21

  
22
__PACKAGE__->meta->unique_keys([ 'name' ]);
23

  
24
1;
25
;
SL/DB/MetaSetup/AuthSchemaInfo.pm
1
# This file has been auto-generated. Do not modify it; it will be overwritten
2
# by rose_auto_create_model.pl automatically.
3
package SL::DB::AuthSchemaInfo;
4

  
5
use strict;
6

  
7
use parent qw(SL::DB::Object);
8

  
9
__PACKAGE__->meta->table('schema_info');
10
__PACKAGE__->meta->schema('auth');
11

  
12
__PACKAGE__->meta->columns(
13
  itime => { type => 'timestamp', default => 'now()' },
14
  login => { type => 'text' },
15
  tag   => { type => 'text', not_null => 1 },
16
);
17

  
18
__PACKAGE__->meta->primary_key_columns([ 'tag' ]);
19

  
20
__PACKAGE__->meta->allow_inline_column_values(1);
21

  
22
1;
23
;
SL/DB/MetaSetup/AuthSession.pm
1
# This file has been auto-generated. Do not modify it; it will be overwritten
2
# by rose_auto_create_model.pl automatically.
3
package SL::DB::AuthSession;
4

  
5
use strict;
6

  
7
use parent qw(SL::DB::Object);
8

  
9
__PACKAGE__->meta->table('session');
10
__PACKAGE__->meta->schema('auth');
11

  
12
__PACKAGE__->meta->columns(
13
  api_token  => { type => 'text' },
14
  id         => { type => 'text', not_null => 1 },
15
  ip_address => { type => 'scalar' },
16
  mtime      => { type => 'timestamp' },
17
);
18

  
19
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
20

  
21
1;
22
;
SL/DB/MetaSetup/AuthSessionContent.pm
1
# This file has been auto-generated. Do not modify it; it will be overwritten
2
# by rose_auto_create_model.pl automatically.
3
package SL::DB::AuthSessionContent;
4

  
5
use strict;
6

  
7
use parent qw(SL::DB::Object);
8

  
9
__PACKAGE__->meta->table('session_content');
10
__PACKAGE__->meta->schema('auth');
11

  
12
__PACKAGE__->meta->columns(
13
  auto_restore => { type => 'boolean' },
14
  sess_key     => { type => 'text', not_null => 1 },
15
  sess_value   => { type => 'text' },
16
  session_id   => { type => 'text', not_null => 1 },
17
);
18

  
19
__PACKAGE__->meta->primary_key_columns([ 'session_id', 'sess_key' ]);
20

  
21
1;
22
;
SL/DB/MetaSetup/AuthUser.pm
4 4

  
5 5
use strict;
6 6

  
7
use base qw(SL::DB::Object);
7
use parent qw(SL::DB::Object);
8 8

  
9 9
__PACKAGE__->meta->table('user');
10 10
__PACKAGE__->meta->schema('auth');
......
19 19

  
20 20
__PACKAGE__->meta->unique_keys([ 'login' ]);
21 21

  
22
# __PACKAGE__->meta->initialize;
23

  
24 22
1;
25 23
;
SL/DB/MetaSetup/AuthUserConfig.pm
4 4

  
5 5
use strict;
6 6

  
7
use base qw(SL::DB::Object);
7
use parent qw(SL::DB::Object);
8 8

  
9 9
__PACKAGE__->meta->table('user_config');
10 10
__PACKAGE__->meta->schema('auth');
11 11

  
12 12
__PACKAGE__->meta->columns(
13
  user_id   => { type => 'integer', not_null => 1 },
14 13
  cfg_key   => { type => 'text', not_null => 1 },
15 14
  cfg_value => { type => 'text' },
15
  user_id   => { type => 'integer', not_null => 1 },
16 16
);
17 17

  
18 18
__PACKAGE__->meta->primary_key_columns([ 'user_id', 'cfg_key' ]);
......
24 24
  },
25 25
);
26 26

  
27
# __PACKAGE__->meta->initialize;
28

  
29 27
1;
30 28
;
SL/DB/MetaSetup/AuthUserGroup.pm
4 4

  
5 5
use strict;
6 6

  
7
use base qw(SL::DB::Object);
7
use parent qw(SL::DB::Object);
8 8

  
9 9
__PACKAGE__->meta->table('user_group');
10 10
__PACKAGE__->meta->schema('auth');
11 11

  
12 12
__PACKAGE__->meta->columns(
13
  user_id  => { type => 'integer', not_null => 1 },
14 13
  group_id => { type => 'integer', not_null => 1 },
14
  user_id  => { type => 'integer', not_null => 1 },
15 15
);
16 16

  
17 17
__PACKAGE__->meta->primary_key_columns([ 'user_id', 'group_id' ]);
......
28 28
  },
29 29
);
30 30

  
31
# __PACKAGE__->meta->initialize;
32

  
33 31
1;
34 32
;
scripts/rose_auto_create_model.pl
13 13
use Digest::MD5 qw(md5_hex);
14 14
use English qw( -no_match_vars );
15 15
use Getopt::Long;
16
use List::MoreUtils qw(none);
16
use List::MoreUtils qw(apply none uniq);
17 17
use List::UtilsBy qw(partition_by);
18 18
use Pod::Usage;
19 19
use Rose::DB::Object 0.809;
......
340 340
  pod2usage(verbose => 99, sections => 'SYNOPSIS');
341 341
}
342 342

  
343
sub list_all_tables {
344
  my ($db) = @_;
345

  
346
  my @schemas = (undef, uniq apply { s{\..*}{} } grep { m{\.} } keys %{ $package_names{KIVITENDO} });
347
  my @tables;
348

  
349
  foreach my $schema (@schemas) {
350
    $db->schema($schema);
351
    push @tables, map { $schema ? "${schema}.${_}" : $_ } $db->list_tables;
352
  }
353

  
354
  $db->schema(undef);
355

  
356
  return @tables;
357
}
358

  
343 359
sub make_tables {
344 360
  my %tables_by_domain;
345 361
  if ($config{all}) {
......
347 363

  
348 364
    foreach my $domain (@domains) {
349 365
      my $db  = SL::DB::create(undef, $domain);
350
      $tables_by_domain{$domain} = [ grep { my $table = $_; none { $_ eq $table } @{ $blacklist{$domain} } } $db->list_tables ];
366
      $tables_by_domain{$domain} = [ grep { my $table = $_; none { $_ eq $table } @{ $blacklist{$domain} } } list_all_tables($db) ];
351 367
      $db->disconnect;
352 368
    }
353 369

  
sql/Pg-upgrade2-auth/session_content_primary_key.sql
1
-- @tag: session_content_primary_key
2
-- @description: Primärschlüssel für Tabelle auth.session_content
3
-- @depends: release_3_3_0
4
ALTER TABLE auth.session_content ADD PRIMARY KEY (session_id, sess_key);

Auch abrufbar als: Unified diff