chore: add csharpier to husky, format backend with csharpier
This commit is contained in:
		
							parent
							
								
									5fab66444f
								
							
						
					
					
						commit
						7f971e8549
					
				
					 73 changed files with 2098 additions and 1048 deletions
				
			
		|  | @ -1,5 +1,5 @@ | |||
| using Microsoft.EntityFrameworkCore.Migrations; | ||||
| using Microsoft.EntityFrameworkCore.Infrastructure; | ||||
| using Microsoft.EntityFrameworkCore.Infrastructure; | ||||
| using Microsoft.EntityFrameworkCore.Migrations; | ||||
| using NodaTime; | ||||
| 
 | ||||
| #nullable disable | ||||
|  | @ -18,38 +18,46 @@ namespace Foxnouns.Backend.Database.Migrations | |||
|                 name: "sid", | ||||
|                 table: "users", | ||||
|                 type: "text", | ||||
|                 nullable: true); | ||||
|                 nullable: true | ||||
|             ); | ||||
| 
 | ||||
|             migrationBuilder.AddColumn<Instant>( | ||||
|                 name: "last_sid_reroll", | ||||
|                 table: "users", | ||||
|                 type: "timestamp with time zone", | ||||
|                 nullable: false, | ||||
|                 defaultValueSql: "now() - '1 hour'::interval"); | ||||
|                 defaultValueSql: "now() - '1 hour'::interval" | ||||
|             ); | ||||
| 
 | ||||
|             migrationBuilder.AddColumn<string>( | ||||
|                 name: "sid", | ||||
|                 table: "members", | ||||
|                 type: "text", | ||||
|                 nullable: true); | ||||
|                 nullable: true | ||||
|             ); | ||||
| 
 | ||||
|             migrationBuilder.CreateIndex( | ||||
|                 name: "ix_users_sid", | ||||
|                 table: "users", | ||||
|                 column: "sid", | ||||
|                 unique: true); | ||||
|                 unique: true | ||||
|             ); | ||||
| 
 | ||||
|             migrationBuilder.CreateIndex( | ||||
|                 name: "ix_members_sid", | ||||
|                 table: "members", | ||||
|                 column: "sid", | ||||
|                 unique: true); | ||||
|                 unique: true | ||||
|             ); | ||||
| 
 | ||||
|             migrationBuilder.Sql(@"create function generate_sid(len int) returns text as $$
 | ||||
|             migrationBuilder.Sql( | ||||
|                 @"create function generate_sid(len int) returns text as $$
 | ||||
|     select string_agg(substr('abcdefghijklmnopqrstuvwxyz', ceil(random() * 26)::integer, 1), '') from generate_series(1, len) | ||||
| $$ language sql volatile; | ||||
| ");
 | ||||
|             migrationBuilder.Sql(@"create function find_free_user_sid() returns text as $$
 | ||||
| "
 | ||||
|             ); | ||||
|             migrationBuilder.Sql( | ||||
|                 @"create function find_free_user_sid() returns text as $$
 | ||||
| declare new_sid text; | ||||
| begin | ||||
|     loop | ||||
|  | @ -58,8 +66,10 @@ begin | |||
|     end loop; | ||||
| end | ||||
| $$ language plpgsql volatile; | ||||
| ");
 | ||||
|             migrationBuilder.Sql(@"create function find_free_member_sid() returns text as $$
 | ||||
| "
 | ||||
|             ); | ||||
|             migrationBuilder.Sql( | ||||
|                 @"create function find_free_member_sid() returns text as $$
 | ||||
| declare new_sid text; | ||||
| begin | ||||
|     loop | ||||
|  | @ -67,7 +77,8 @@ begin | |||
|         if not exists (select 1 from members where sid = new_sid) then return new_sid; end if; | ||||
|     end loop; | ||||
| end | ||||
| $$ language plpgsql volatile;");
 | ||||
| $$ language plpgsql volatile;"
 | ||||
|             ); | ||||
|         } | ||||
| 
 | ||||
|         /// <inheritdoc /> | ||||
|  | @ -77,25 +88,15 @@ $$ language plpgsql volatile;"); | |||
|             migrationBuilder.Sql("drop function find_free_user_sid;"); | ||||
|             migrationBuilder.Sql("drop function generate_sid;"); | ||||
| 
 | ||||
|             migrationBuilder.DropIndex( | ||||
|                 name: "ix_users_sid", | ||||
|                 table: "users"); | ||||
|             migrationBuilder.DropIndex(name: "ix_users_sid", table: "users"); | ||||
| 
 | ||||
|             migrationBuilder.DropIndex( | ||||
|                 name: "ix_members_sid", | ||||
|                 table: "members"); | ||||
|             migrationBuilder.DropIndex(name: "ix_members_sid", table: "members"); | ||||
| 
 | ||||
|             migrationBuilder.DropColumn( | ||||
|                 name: "sid", | ||||
|                 table: "users"); | ||||
|             migrationBuilder.DropColumn(name: "sid", table: "users"); | ||||
| 
 | ||||
|             migrationBuilder.DropColumn( | ||||
|                 name: "last_sid_reroll", | ||||
|                 table: "users"); | ||||
|             migrationBuilder.DropColumn(name: "last_sid_reroll", table: "users"); | ||||
| 
 | ||||
|             migrationBuilder.DropColumn( | ||||
|                 name: "sid", | ||||
|                 table: "members"); | ||||
|             migrationBuilder.DropColumn(name: "sid", table: "members"); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue