@@ -26,7 +26,6 @@ pub enum AppliedPolicy {
2626 Table ,
2727 Id ,
2828 SecretMetadataId ,
29- Type ,
3029 PolicyId ,
3130 CreatedAt ,
3231 UpdatedAt ,
@@ -82,6 +81,17 @@ pub enum SecretValue {
8281 UpdatedAt ,
8382}
8483
84+ #[ derive( DeriveIden ) ]
85+ pub enum Authority {
86+ Table ,
87+ Id ,
88+ Name ,
89+ Host ,
90+ PublicKey ,
91+ CreatedAt ,
92+ UpdatedAt ,
93+ }
94+
8595#[ derive( DeriveMigrationName ) ]
8696pub struct Migration ;
8797
@@ -131,7 +141,6 @@ impl MigrationTrait for Migration {
131141 . if_not_exists ( )
132142 . col ( char_len ( AppliedPolicy :: Id , 26 ) . primary_key ( ) )
133143 . col ( char_len ( AppliedPolicy :: SecretMetadataId , 26 ) )
134- . col ( string_len ( AppliedPolicy :: Type , 50 ) )
135144 . col ( char_len ( AppliedPolicy :: PolicyId , 26 ) )
136145 . col ( timestamp_with_time_zone ( AppliedPolicy :: CreatedAt ) )
137146 . col ( timestamp_with_time_zone ( AppliedPolicy :: UpdatedAt ) )
@@ -222,12 +231,33 @@ impl MigrationTrait for Migration {
222231 . take ( ) ,
223232 )
224233 . await ?;
225-
234+ manager
235+ . create_table (
236+ Table :: create ( )
237+ . table ( Authority :: Table )
238+ . if_not_exists ( )
239+ . col ( char_len ( Authority :: Id , 26 ) . primary_key ( ) )
240+ . col ( string_len ( Authority :: Name , 255 ) )
241+ . col ( text ( Authority :: Host ) )
242+ . col ( text_null ( Authority :: PublicKey ) )
243+ . col ( timestamp_with_time_zone ( Authority :: CreatedAt ) )
244+ . col ( timestamp_with_time_zone ( Authority :: UpdatedAt ) )
245+ . take ( ) ,
246+ )
247+ . await ?;
226248 Ok ( ( ) )
227249 }
228250
229251 async fn down ( & self , manager : & SchemaManager ) -> Result < ( ) , DbErr > {
230252 manager. drop_table ( Table :: drop ( ) . table ( AppliedPathPolicy :: Table ) . if_exists ( ) . take ( ) ) . await ?;
253+ manager. drop_table ( Table :: drop ( ) . table ( Authority :: Table ) . if_exists ( ) . take ( ) ) . await ?;
254+ manager. drop_table ( Table :: drop ( ) . table ( AppliedPathPolicyAllowedAction :: Table ) . if_exists ( ) . take ( ) ) . await ?;
255+ manager. drop_table ( Table :: drop ( ) . table ( AppliedPolicy :: Table ) . if_exists ( ) . take ( ) ) . await ?;
256+ manager. drop_table ( Table :: drop ( ) . table ( Parameter :: Table ) . if_exists ( ) . take ( ) ) . await ?;
257+ manager. drop_table ( Table :: drop ( ) . table ( Path :: Table ) . if_exists ( ) . take ( ) ) . await ?;
258+ manager. drop_table ( Table :: drop ( ) . table ( Policy :: Table ) . if_exists ( ) . take ( ) ) . await ?;
259+ manager. drop_table ( Table :: drop ( ) . table ( SecretMetadata :: Table ) . if_exists ( ) . take ( ) ) . await ?;
260+ manager. drop_table ( Table :: drop ( ) . table ( SecretValue :: Table ) . if_exists ( ) . take ( ) ) . await ?;
231261
232262 Ok ( ( ) )
233263 }
0 commit comments