mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-22 13:12:19 +00:00
Clean up some scripts
This commit is contained in:
1 parent
2ffdc5cbe5
commit
50cbeb7677
4 files changed
+41
-31
No files matched your search
@@ -1,14 +1,13 @@
|
||||
diff --git a/Spacebar.Db/Contexts/SpacebarDbContext.cs b/Spacebar.Db/Contexts/SpacebarDbContext.cs
|
||||
index 0a707c75..7d380b1c 100644
|
||||
--- a/Spacebar.Db/Contexts/SpacebarDbContext.cs
|
||||
+++ b/Spacebar.Db/Contexts/SpacebarDbContext.cs
|
||||
diff --git a/Spacebar.Models.Db/Contexts/SpacebarDbContext.cs b/Spacebar.Models.Db/Contexts/SpacebarDbContext.cs
|
||||
index 48bd953b..831bddce 100644
|
||||
--- a/Spacebar.Models.Db/Contexts/SpacebarDbContext.cs
|
||||
+++ b/Spacebar.Models.Db/Contexts/SpacebarDbContext.cs
|
||||
@@ -1,7 +1,6 @@
|
||||
-using System;
|
||||
-using System;
|
||||
-using System.Collections.Generic;
|
||||
-using Microsoft.EntityFrameworkCore;
|
||||
+using Microsoft.EntityFrameworkCore;
|
||||
using Spacebar.Db.Models;
|
||||
+using Stream = Spacebar.Db.Models.Stream;
|
||||
|
||||
namespace Spacebar.Db.Contexts;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Spacebar.Models.Db.Models;
|
||||
+using Stream = Spacebar.Models.Db.Models.Stream;
|
||||
|
||||
namespace Spacebar.Models.Db.Contexts;
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
diff --git a/Spacebar.Db/Models/User.cs b/Spacebar.Db/Models/User.cs
|
||||
diff --git a/Spacebar.Models.Db/Models/User.cs b/Spacebar.Models.Db/Models/User.cs
|
||||
index 7af60bf4..323846d4 100644
|
||||
--- a/Spacebar.Db/Models/User.cs
|
||||
+++ b/Spacebar.Db/Models/User.cs
|
||||
--- a/Spacebar.Models.Db/Models/User.cs
|
||||
+++ b/Spacebar.Models.Db/Models/User.cs
|
||||
@@ -90,19 +90,19 @@ public partial class User
|
||||
public string? Email { get; set; }
|
||||
|
||||
|
||||
[Column("flags")]
|
||||
- public long Flags { get; set; }
|
||||
+ public ulong Flags { get; set; }
|
||||
|
||||
|
||||
[Column("public_flags")]
|
||||
- public long PublicFlags { get; set; }
|
||||
+ public ulong PublicFlags { get; set; }
|
||||
|
||||
|
||||
[Column("purchased_flags")]
|
||||
- public long PurchasedFlags { get; set; }
|
||||
+ public ulong PurchasedFlags { get; set; }
|
||||
|
||||
|
||||
[Column("premium_usage_flags")]
|
||||
public int PremiumUsageFlags { get; set; }
|
||||
|
||||
|
||||
[Column("rights")]
|
||||
- public long Rights { get; set; }
|
||||
+ public ulong Rights { get; set; }
|
||||
|
||||
|
||||
[Column("data")]
|
||||
public string Data { get; set; } = null!;
|
||||
@@ -1,20 +1,25 @@
|
||||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i nix -p nix
|
||||
#! nix shell nixpkgs#bash nixpkgs#dotnet-ef nixpkgs#postgresql --command bash
|
||||
#! nix shell nixpkgs#bash nixpkgs#dotnet-ef nixpkgs#postgresql nixpkgs#nodejs nixpkgs#dos2unix --command bash
|
||||
|
||||
set -ex
|
||||
rm -rfv Spacebar.Db
|
||||
rm -rfv Models/Spacebar.Models.Db
|
||||
|
||||
# prep temporary db
|
||||
# - Update collation version for template1 just incase!
|
||||
psql -U postgres -c 'ALTER DATABASE template1 REFRESH COLLATION VERSION;'
|
||||
dropdb -U postgres sb-server-scaffold --if-exists --force || true
|
||||
createdb -U postgres sb-server-scaffold
|
||||
DATABASE=postgres://postgres@127.0.0.1/sb-server-scaffold nix shell nixpkgs#nodejs ../.. --command npm run sync:db
|
||||
# - Build spacebar-ts and apply it's migrations
|
||||
pushd ../..
|
||||
npm run build:src:tsgo
|
||||
DATABASE=postgres://postgres@127.0.0.1/sb-server-scaffold npm run apply:migrations
|
||||
popd
|
||||
|
||||
# Create new project
|
||||
dotnet new classlib --no-restore -o Spacebar.Db
|
||||
cd Spacebar.Db
|
||||
pushd Models
|
||||
dotnet new classlib --no-restore -o Spacebar.Models.Db
|
||||
pushd Spacebar.Models.Db
|
||||
rm Class1.cs
|
||||
dotnet add package Npgsql.EntityFrameworkCore.PostgreSQL -n -f net9.0
|
||||
dotnet add package Microsoft.EntityFrameworkCore.Design -n -f net9.0
|
||||
@@ -29,9 +34,13 @@ dotnet-ef dbcontext scaffold "Host=127.0.0.1; Username=postgres; Database=sb-ser
|
||||
--force \
|
||||
--no-onconfiguring \
|
||||
--data-annotations
|
||||
|
||||
for patch in ../db-patches/*.patch; do
|
||||
patch -p1 < $patch
|
||||
|
||||
for f in **/*.cs; do
|
||||
dos2unix --verbose --keepdate "$f"
|
||||
done
|
||||
|
||||
echo 'Scaffolded database and applied patches. Dont forget to generate new patches with `git diff --relative Spacebar.Db/path/xyz > db-patches/001-your-patch-name.patch!`'
|
||||
for patch in ../db-patches/*.patch; do
|
||||
patch --verbose -p2 < $patch
|
||||
done
|
||||
|
||||
echo 'Scaffolded database and applied patches. Dont forget to generate new patches with `cd Models && git diff --relative Spacebar.Models.Db/path/xyz > db-patches/001-your-patch-name.patch!`'
|
||||
@@ -26,12 +26,14 @@ time (
|
||||
echo -en "\nRemoving specific known large unneeded packages: "
|
||||
rm -rf ./node_modules/typescript && echo -n .
|
||||
rm -rf ./node_modules/@typescript/native-preview && echo -n .
|
||||
rm -rf ./node_modules/@tsconfig && echo -n .
|
||||
rm -rf ./node_modules/ts-node && echo -n .
|
||||
rm -rf ./node_modules/node-gyp && echo -n .
|
||||
rm -rf ./node_modules/node-gyp-build-optional-packages && echo -n .
|
||||
rm -rf ./node_modules/discord-protos/{discord_protos,scripts} && echo -n .
|
||||
rm -f ./node_modules/.package-lock.json && echo -n .
|
||||
rm -rf ./node_modules/@jimp/plugin-print/fonts && echo -n . # duplicated in dist/fonts
|
||||
rm -rf ./node_modules/@toondepauw/node-zstd-linux-x64-musl && echo -n .
|
||||
for i in ./node_modules/@jimp/*; do
|
||||
if [ -d "$i/dist/commonjs" ]; then
|
||||
rm -rf "$i/dist/commonjs" && echo -n .
|
||||
@@ -113,7 +115,7 @@ time (
|
||||
find ./node_modules -regextype posix-extended -iregex '.*(\.(swp|swo|eslintcache)|~)$' -type f -delete -printf .
|
||||
find ./node_modules -regextype posix-extended -iregex '.*\.(vscode|editorconfig|pre-commit-config\.yaml)$' -type f -delete -printf .
|
||||
find ./node_modules -regextype posix-extended -iregex '.*\.(vscode|idea)$' -type d -exec rm -rf {} + -printf .
|
||||
find ./node_modules -regextype posix-extended -iregex '.*\.jsdoc-conf\.json$' -type d -exec rm -rf {} + -printf .
|
||||
find ./node_modules -regextype posix-extended -iregex '.*\.jsdoc-conf\.json$' -type f -delete -printf .
|
||||
find ./node_modules -iname '*.iml' -type f -delete -printf .
|
||||
echo -en "\n - CI configuration files: "
|
||||
find ./node_modules -regextype posix-extended -iregex '.*(travis|circleci|github|gitlab|airtap|appveyor|wercker|codeship|drone|semaphoreci|buildkite).*\.(yml|yaml)$' -type f -delete -printf .
|
||||
|
||||
Reference in new issue
Block a user