Move PostsType into submodule, commit local changes

This commit is contained in:
towards-a-new-leftypol 2024-01-13 11:22:06 -05:00
parent af424fb887
commit 54a14156d0
8 changed files with 21 additions and 34 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "src/Common"]
path = src/Common
url = https://github.com/towards-a-new-leftypol/chandlr-common.git

View File

@ -23,7 +23,7 @@ if [[ ! -f "$SETTINGS_FILE" ]]; then
exit 1 exit 1
fi fi
PROG="./dist-newstyle/build/x86_64-linux/ghc-9.2.8/chan-delorean-0.0.1/x/chan-delorean/build/chan-delorean/chan-delorean" PROG="./dist-newstyle/build/x86_64-linux/ghc-9.4.8/chan-delorean-0.0.1/x/chan-delorean/build/chan-delorean/chan-delorean"
# Ensure chan-delorean is compiled and available # Ensure chan-delorean is compiled and available
if ! command -v $PROG >/dev/null; then if ! command -v $PROG >/dev/null; then
@ -37,7 +37,7 @@ while IFS= read -r BACKUP_PATH; do
sed -e 's|\("backup_read_root": \)".*"|\1"'"$BACKUP_PATH"'"|' "$SETTINGS_FILE" > "temp_$SETTINGS_FILE" sed -e 's|\("backup_read_root": \)".*"|\1"'"$BACKUP_PATH"'"|' "$SETTINGS_FILE" > "temp_$SETTINGS_FILE"
# Run the Haskell program with the updated settings file # Run the Haskell program with the updated settings file
time $PROG +RTS -N2 -RTS "temp_$SETTINGS_FILE" time $PROG +RTS -N2 -RTS -j "temp_$SETTINGS_FILE"
done < "$PATHS_FILE" done < "$PATHS_FILE"
# Optionally, remove the temporary settings file # Optionally, remove the temporary settings file

View File

@ -80,7 +80,7 @@ executable chan-delorean
-- other-extensions: -- other-extensions:
-- Other library packages from which modules are imported. -- Other library packages from which modules are imported.
build-depends: base ^>=4.16.4.0, build-depends: base,
aeson, aeson,
bytestring, bytestring,
cmdargs, cmdargs,

View File

@ -588,7 +588,7 @@ grouped AS (
$$; $$;
SELECT * FROM posts WHERE body_search_index @@ websearch_to_tsquery('english', 'holocaust'); SELECT * FROM posts WHERE body_search_index @@ websearch_to_tsquery('english', 'portfolios of color');
WITH query AS ( WITH query AS (
@ -609,10 +609,20 @@ WHERE p.body_search_index @@ websearch_to_tsquery('english', search_text)
ORDER BY ts_rank(p.body_search_index, websearch_to_tsquery('english', search_text)) DESC; ORDER BY ts_rank(p.body_search_index, websearch_to_tsquery('english', search_text)) DESC;
$$ LANGUAGE sql STABLE; $$ LANGUAGE sql STABLE;
SELECT * FROM search_posts('found this board lainchan');
SELECT * FROM search_posts('alt chans') s
JOIN threads ON threads.thread_id = s.thread_id
JOIN boards ON boards.board_id = threads.board_id;
SELECT * FROM information_schema.role_routine_grants; SELECT * FROM information_schema.role_routine_grants;
SELECT * FROM posts WHERE board_post_id = 558;
SELECT * FROM posts WHERE thread_id = 12790 ORDER BY board_post_id ASC; -- last post: 2023-10-30 14:20:07.000 -0400
SELECT * FROM posts JOIN threads ON posts.thread_id = threads.thread_id JOIN boards on boards.board_id = threads.board_id
WHERE board_post_id = 555
AND pathpart = 'posad'
ORDER BY board_post_id ASC;
SELECT to_tsvector('english', body) FROM posts WHERE board_post_id = 476524; SELECT to_tsvector('english', body) FROM posts WHERE board_post_id = 476524;

View File

@ -197,7 +197,7 @@ $$ LANGUAGE sql;
SELECT * FROM fetch_catalog(NOW() - INTERVAL '1y', 1001); SELECT * FROM fetch_catalog(NOW() - INTERVAL '1y', 1001);
SELECT * FROM fetch_catalog(NOW(), 1000); SELECT * FROM fetch_catalog(NOW(), 5000);
SELECT count(*) FROM posts; SELECT count(*) FROM posts;

View File

@ -29,11 +29,6 @@ newtype SettingsCLI = SettingsCLI
{ jsonFile :: FilePath { jsonFile :: FilePath
} deriving (Show, Data, Typeable) } deriving (Show, Data, Typeable)
settingsCLI :: SettingsCLI
settingsCLI = SettingsCLI
{ jsonFile = def &= args &= typ "settings-jsonfile-path"
} &= summary "Backfill v0.0.2"
listCatalogDirectories :: JSONSettings -> IO [ FilePath ] listCatalogDirectories :: JSONSettings -> IO [ FilePath ]
listCatalogDirectories settings = do listCatalogDirectories settings = do
@ -302,7 +297,7 @@ processBackupDirectory settings = do
main :: IO () main :: IO ()
main = do main = do
settingsValue <- cmdArgs settingsCLI settingsValue <- cmdArgs $ SettingsCLI "backfill_settings.json"
let filePath = jsonFile settingsValue let filePath = jsonFile settingsValue
if null filePath if null filePath
then do then do

1
src/Common Submodule

@ -0,0 +1 @@
Subproject commit 0026e48cea06e2768f7a22f4a25bf115debcea35

View File

@ -1,22 +0,0 @@
{-# LANGUAGE DeriveAnyClass #-}
module PostsType
( Post (..) )
where
import GHC.Generics
import Data.Aeson (FromJSON, ToJSON)
import Data.Time.Clock (UTCTime) -- Required for timestamp with time zone
import Data.Int (Int64)
import Data.Text (Text)
data Post = Post
{ post_id :: Maybe Int64
, board_post_id :: Int64
, creation_time :: UTCTime
, body :: Maybe Text
, name :: Maybe Text
, subject :: Maybe Text
, email :: Maybe Text
, thread_id :: Int
} deriving (Show, Generic, FromJSON, ToJSON)