IT |
ITmedia 総合記事一覧 |
[ITmedia News] 「アイドルマスター」公式Twitterの一部が突如消失 「デレステ」や「シャニマス」など 原因不明 |
https://www.itmedia.co.jp/news/articles/2307/05/news108.html
|
itmedia |
2023-07-05 12:53:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia News] Yahoo!ショッピングに定期購入機能 値付けやポイントで差別化も |
https://www.itmedia.co.jp/news/articles/2307/05/news106.html
|
itmedianewsyahoo |
2023-07-05 12:38:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia ビジネスオンライン] 振り子式特急「381系」まもなくラストラン カーブ駆け抜け半世紀 |
https://www.itmedia.co.jp/business/articles/2307/05/news105.html
|
itmedia |
2023-07-05 12:21:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia Mobile] OPPOの中国向けミッドレンジモデルは日本のReno Aシリーズにはない仕上げ |
https://www.itmedia.co.jp/mobile/articles/2307/05/news102.html
|
itmediamobileoppo |
2023-07-05 12:15:00 |
TECH |
Techable(テッカブル) |
ガイアックス、福岡市の起業家輩出プログラムの運営受託。スタートアップエコシステム活性化支援 |
https://techable.jp/archives/212848
|
株式会社ガイアックス |
2023-07-05 03:00:59 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
素数判定プログラム |
https://qiita.com/ShunichiMurata/items/2b03a90ebd919734c9c2
|
primenumber |
2023-07-05 12:45:58 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
医療系チャットボットの作成(Python×ChatGPT) |
https://qiita.com/ikuro_mori/items/02b34392cc99d1294508
|
chatgpt |
2023-07-05 12:14:15 |
技術ブログ |
Developers.IO |
Azure OpenAIを使ったチャットボットWebアプリをAzureに閉じたネットワーク環境に構築する方法 |
https://dev.classmethod.jp/articles/azure-openai-chatbot-in-closed-network/
|
azure |
2023-07-05 03:38:23 |
海外TECH |
DEV Community |
Timestamp SQL Files for Consistent Laravel Migration |
https://dev.to/kushalraj/timestamp-sql-files-for-consistent-laravel-migration-2mn3
|
Timestamp SQL Files for Consistent Laravel Migration BackgroundAs applications scale and become more complex advanced database concepts like functions triggers and stored procedures are often introduced In Laravel these concepts can be implemented by writing SQL query files and executing them through migration files However as the application evolves and additional functionality is added the need to update these database functions arises This can lead to migration issues if the modified function declaration refers to new relations and columns that have not been created yet SolutionTo overcome this challenge one effective approach is to create timestamped SQL files that correspond to the migration files using them By associating timestamped SQL files with migration files developers can ensure consistency between the database schema and the application code These timestamped SQL files serve as snapshots of the database function at the time of their usage ensuring that modifications to the functions do not disrupt the migration process This blog post explores the benefits and implementation of timestamped SQL files for Laravel migration focusing on the application stack of Laravel and PostgreSQL Benefits of Timestamped SQL FilesBy associating timestamped SQL files with migration files developers can ensure consistency between the database schema and the application code Here are some key benefits of using this approach Seamless Migration Execution Timestamped SQL files allow migrations to be executed without conflicts even when modifications are made to the database functions This prevents errors and ensures smooth application deployment Version Control Integration Timestamped SQL files enable easy tracking of changes made to database functions By following a timestamped naming convention it becomes simple to identify and compare different versions of SQL files enhancing version control practices Team Collaboration Timestamped SQL files facilitate collaboration among team members by providing a clear history of modifications Developers can work concurrently on different SQL files and migrations reducing conflicts and improving productivity Implementation StepsNow let s dive into the steps required to implement timestamped SQL files for Laravel migration Step Creating Timestamped SQL FilesChoose a naming convention for the SQL files that includes a timestamp A proper way would to name an SQL file would be timestamp action entity name and type For example YYYY MM DD HHMMSS extract cleaned company name function sqlNote Here we have used timestamp format used by Laravel when creating migration files Using this way ensures our files are listed properly in IDE s file explorer Store the SQL files in a designated directory within your Laravel project such as the database migrations sql folder Example of SQL above file create extract cleaned company name function sqlCREATE FUNCTION extract cleaned company name companyName varchar RETURNS varchar AS DECLARE cleanedCompanyName varchar replacePattern varchar BEGIN replacePattern s cleanedCompanyName REGEXP REPLACE cleanedCompanyName replacePattern g cleanedCompanyName LOWER cleanedCompanyName RETURN cleanedCompanyName END LANGUAGE plpgsql Step Writing Migration FilesCreate a migration file using the artisan command line tool following Laravel s migration conventions php artisan make migration create extract cleaned company name functionInside the migration file s up method use the DB unprepared function to execute the corresponding timestamped SQL file For example create extract cleaned company name function phppublic function up this gt down sql file get contents database path migrations sql create extract cleaned company name function sql DB unprepared sql public function down sql DROP FUNCTION IF EXISTS extract cleaned company name varchar DB unprepared sql Note We call down method to avoid creating a function that already exists when we execute the SQL query to create our function Step Modifying Database FunctionsWhen changes are required in the database functions create a new timestamped SQL file with the updated function declaration Ensure that the new SQL file name follows the same timestamp format as the new migration file For example SQL file create extract cleaned company name function sqlMigration file update extract cleaned company name function phpStep Running MigrationsUse Laravel s migration commands php artisan migrate to execute the migrations including the timestamped SQL files Laravel will handle the execution of the SQL files ensuring consistency between the database schema and the application code ConclusionTimestamped SQL files offer a robust solution for managing changes in advanced database concepts within Laravel applications By associating SQL files with migration files and adopting a timestamp naming convention developers can seamlessly update database functions without risking migration conflicts This approach improves version control practices enhances collaboration among team members and ensures a smooth deployment process Leveraging the power of Laravel and PostgreSQL you can confidently scale your application while maintaining a consistent and reliable database schema Remember to regularly update your timestamped SQL files as your application evolves and enjoy the benefits of a well maintained and flexible database structure within your Laravel project |
2023-07-05 03:40:50 |
海外科学 |
BBC News - Science & Environment |
Memo reveals pressure on climate finance pledge |
https://www.bbc.co.uk/news/uk-66105901?at_medium=RSS&at_campaign=KARANGA
|
budget |
2023-07-05 03:11:00 |
ニュース |
BBC News - Home |
Memo reveals pressure on climate finance pledge |
https://www.bbc.co.uk/news/uk-66105901?at_medium=RSS&at_campaign=KARANGA
|
budget |
2023-07-05 03:11:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
中国半導体業界、米の輸出規制強化に身構え - WSJ発 |
https://diamond.jp/articles/-/325665
|
輸出規制 |
2023-07-05 12:09:00 |
IT |
週刊アスキー |
NICT、日本語に特化した大規模言語モデルを発表 純国産ChatGPTも近い? |
https://weekly.ascii.jp/elem/000/004/143/4143904/
|
chatgpt |
2023-07-05 12:15:00 |
IT |
週刊アスキー |
横浜市唯一の海水浴場「海の公園海水浴場」が7月8日よりオープン |
https://weekly.ascii.jp/elem/000/004/143/4143914/
|
海の公園 |
2023-07-05 12:45:00 |
IT |
週刊アスキー |
横浜限定商品やオープニングキャンペーンも! そごう横浜店に「TOKYOチューリップローズ」出店 |
https://weekly.ascii.jp/elem/000/004/143/4143901/
|
tokyo |
2023-07-05 12:30:00 |
海外TECH |
reddit |
【悲報】日本が出生率を捏造!分母を小さくして過大に見せていたことが判明! 合計特殊出生率 実態は公表値よりもっと低かった…専門家が「信じられない」統計手法とは:東京新聞 TOKYO Web |
https://www.reddit.com/r/newsokuexp/comments/14qyrk9/悲報日本が出生率を捏造分母を小さくして過大に見せていたことが判明_合計特殊出生率/
|
ornewsokuexplinkcomments |
2023-07-05 03:16:30 |
コメント
コメントを投稿